-5

I have exe file called Myapp.exe. Now I want to convert .exe to jar file. That jar file should also work in NON JAVA system. I don't have any idea to implement it. Can anyone please suggest me how to do it?

Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
user2155502
  • 11
  • 1
  • 4

2 Answers2

3

Direct conversion not available !!! because they are in entirely different platforms.

enter image description here

XEENA
  • 569
  • 2
  • 6
2

Meeting your requirements is impossible for two reasons.

1) You cannot change an EXE to a JAR file.

2) You cannot run a JAR file on a system that doesn't have Java installed.

If you want to run something on a (Windows) system with no Java installation, it needs to be an EXE ... or something else that doesn't require Java.

(It might help if you explained why you think you need to do this. Perhaps there is an alternative set of requirements that are not impossible to meet.)


why i am doing all those stubs is for making my jar has to work in java not installed system.

It needs to be an EXE then!

I have an jar.It is working fine in java installed system.My task is to Bundle jre inside jar(Not along with jar(i.e we can put jre and jar in same folder to run a jar as given in following url mindfiresolutions.com/… ))Because i have to give jar file only to client,in such a way that they can use this Myapp.jar in non java system also.But,i don't know how to bundle jre inside jar.I Don't how to run jre inside jar?

Ermm ...

Is it possible?

No. You cannot embed a JRE inside a JAR file in any way that would allow it (the JAR file) to run your Java code without first installing Java. (And installing Java would defeat the purpose of embedding the JRE ... of course.)

But what you can do is create an EXE file which has a JRE and a JAR embedded in it. And there are tools for doing this. Here's the canonical Question on how to do it:


I think you need to read the Oracle documentation on what a JAR file really is, and how Java programs are normally executed. That will help you understand what is feasible ... and what is nonsensical.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • why i am doing all those stubs is for making my jar has to work in java not installed system.I have an jar.It is working fine in java installed system.My task is to Bundle jre inside jar(Not along with jar(i.e we can put jre and jar in same folder to run a jar as given in following url http://www.mindfiresolutions.com/Run-jar-without-jre-on-windows-machine-76.php ))Because i have to give jar file only to client,in such a way that they can use this Myapp.jar in non java system also.But,i don't know how to bundle jre inside jar.I Don't how to run jre inside jar?Is it possible? – user2155502 Mar 12 '13 at 10:45
  • Thanks for your reply Sir.. We can convert jar to .exe using tools like launch4j,etc.. I did it using launch4j tool and converted jar to exe.. and it is working fine.. Since,jre will bundled inside jar.. But,i must give jar file only to client.. Is there any way to bundle? – user2155502 Mar 12 '13 at 11:52
  • @user2155502 Not possible. A jar file is not magic. It is (literally) just a zip file containing .class files and other program resources. On its own, a jar cannot do anything. To be useful, it **needs** another program, such as the JRE or a launcher. – Boann Mar 12 '13 at 12:55