Click to See Complete Forum and Search --> : Compile / Convert JAR Files to EXE ? Can I do this?
WarrenW
Apr 19th, 2002, 10:02 AM
Hello,
I had someone write me a jar file which i can run on my machine after having the java runtile files installed. I would not like to create it into a standalone application as an exe. Can I take something like JBuilder or Visual J++ and create an exe from this? And will it link in all of these needed files?
Any help would be appreciated! I am a VB programmer but am stuck with this JAR file for another application I need to distribute.
Thanks!
Mrs Kensington
Apr 19th, 2002, 12:50 PM
Normally you can't convert a jar file into an executable as the files in that Jar file gets translated by the java run time envronment.
But there is a way of compiling java files into an executable. You need to use a program called JET. The personal edition(which is free) can be obtained from here... http://www.excelsior-usa.com/
the personal edition CAN convert jar files to an exe BUT you need JET and the Java Runtime Environment installed to run them. So all it does is speed up execution.
There is a version of JET that allows you to distribute all the JET files in a nice installer but that costs $400.
WarrenW
Apr 19th, 2002, 02:55 PM
Thanks! I used a program called TurboZip and it uncompressed the JAR file and I got a bunch of class files. Is this the source to the while program? Could I now use another program and compile into an exe? If so, what would you suggest?
Actually I could just use the program you mentioned with the installed for $400 but if I want to make changes to some of the code like changing come captions in the program, do I use something like JBuilder?
Once I understand the tools and formats of this java stuff, i will be good to go!
I appreciate your help!
Mrs Kensington
Apr 22nd, 2002, 03:31 AM
The class files you found are compiled Java source files. Java compiles its source into an intermediatry language and it's these files that are executed by the virtual machine.
The source code files should end in .java and its these that you would re-compile after any changes.
To compile / recompile the java files all you need is the JDK (Java Development Kit) this can be obtained from http://java.sun.com/j2se/1.4/download.html
The JDK contains javac.exe which is that java compiler. JBuilder is just a IDE (Integrated Development Environment) that uses javc.exe. So you need the JDK even if you are using JBuilder.
My personal experience is that i found JBuilder very hard to get working and it took a fair bit of knowledge of command line program to get it to compile properly.
Compiling is as easy as going to the directory the java files are stored and typing javac *.java (though your PATH variable needs to be pointing to javac.exe).
If you only have the class files and thus don't have the source to the program you can get de-compilers. These are illegal to use if you don't have the authors permission (and if you have the authors permission why do you need a de-compiler :) ) and they can produce very hard to read code. But they do give you working source code 90% of the time.
A search for Java de-compiler on google wuld probably find you one.
I hope thats been a help and hasn't confused you to much!
Mrs Kensington
CaptainPinko
Apr 28th, 2002, 08:42 PM
you can get apps that "wrap" the class files by making the call to the JVM for you kinda like a batch file back in the day, the file is still cross platform independent and easy-to-run, tho checkout Sun's Java Web Start, its makes Desktop\Start Mernu shortcuts for any java apps, handy
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.