Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I extract java exe to jar

Tags:

java

I have an exe that I know was written in java. I understand that java programs can be made into an exe and there are tools to convert jar files to exe but is it possible to convert back? AFAIK jar files can be run on any platform that can run java and I would like to use a windows compiled java program on mac without using any extra virtualisation (wine,vmware)

like image 608
Tim Matthews Avatar asked Nov 25 '08 08:11

Tim Matthews


People also ask

Can you convert exe to jar?

Replies (1)  Jar files are Java files, ordinary exe files cannot be converted to jar files, because the original application would not have been coded in Java . . Jar to exe can convert a jar file to an exe, by including the java runtime inside the exe file, that does not work the other way around . ..

How do I Export a Java project as executable jar in eclipse?

To export your project, right-click it and select Export. Select Java > Runnable JAR file as the export destination and click Next. On the next page, specify the name and path of the JAR file to create and select the Launch configuration that includes the project name and the name of the test class.


1 Answers

It depends how the exe has been built:

  • If it has simply wrapped, with a tool like JSmooth, the same tool can extract the jar
  • If it it has been compiled, with for instance gcj (as illustrated by this question),... I am not sure.
  • If it has been compiled by a static compiler (or AOT - Ahead-Of-Time -), I believe it is not possible to extract the orignial jars.
like image 72
VonC Avatar answered Oct 12 '22 15:10

VonC