|
-
Nov 2nd, 2002, 04:10 PM
#1
Thread Starter
Hyperactive Member
Creating java .exe's
This may seem a really stupid question, but how exactly do you change ur java programs into .exe's.
In other words, how do i get it so i dont need to type java myprogram at the command line to run it.
Thanks in advance for any assistance you can offer
-
Nov 2nd, 2002, 07:27 PM
#2
Addicted Member
As far as I know, you cannot just make .java files into .exe. This is because of the way Java works.
.java files are compiled into Java byte code, which is the .class file you generate. By running java MyClass, you are interpreting the byte code through the java interpreter. This is the reason java is platform independant - the interpreter does the 'work'. By generating .class files, the programs are in a standard format - java byte code.
I believe that it's possible in Visual J++ (not java), but other than that I'm not too sure. I seem to remember a thread on this forum asking this and someone gave a 'maybe' answer.
Sorry
HD
-
Nov 3rd, 2002, 03:44 PM
#3
Thread Starter
Hyperactive Member
Originally posted by HairyDave
As far as I know, you cannot just make .java files into .exe. This is because of the way Java works.
.java files are compiled into Java byte code, which is the .class file you generate. By running java MyClass, you are interpreting the byte code through the java interpreter. This is the reason java is platform independant - the interpreter does the 'work'. By generating .class files, the programs are in a standard format - java byte code.
I believe that it's possible in Visual J++ (not java), but other than that I'm not too sure. I seem to remember a thread on this forum asking this and someone gave a 'maybe' answer.
Sorry
HD
Thanks, I was just wondering as the likes of Star Office and Forte for Java are both EXE's and i was assuming they were both written in java, since both are Sun Microsystems products.
-
Nov 4th, 2002, 04:43 AM
#4
Addicted Member
As I said, I think there are 'some' ways to make java exes but I don't know what they are, and more importantly I don't know what they do to make them exes. It could be just a wrapper to call java myClass - or something just as foolish.
There is another thread that talks about JIT compilers (dont know about them so dont quote me). Apparently they can compile java code.
HD
-
Nov 4th, 2002, 01:50 PM
#5
Yer average Java app is not an exe. It's good that way, because exes are not portable, which is what Java is all about.
Visual J++ could compile Java code to native code, but that defeats the purpose and VJ++ is dying anyway.
gcc can compile Java code to native code too.
JIT (Just-In-Time) compilers aren't very different from normal Java Virtual Machines. But while a JVM reads in the bytecode and executes it byte per byte (interpret it) and JITC will read in the whole byte code prior to startup (or at least a large chunk), compile it in memory to native code and let's that execute. It takes it longer than a JVM to start the java app, but the app will run faster. But you lose the sandbox effect, which is why you can't use it for applets.
But you would still have to start a JITC, so instead of
java MyClass
you would write
jjitc MyClass
which isn't really a difference.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 4th, 2002, 04:18 PM
#6
Hyperactive Member
Here are 2 progs that compile to machine code:
TowerJ - http://www.towerj.com/
VisualAge - http://www-3.ibm.com/software/ad/vajava/
Enjoy
-
Nov 8th, 2002, 04:16 PM
#7
Dazed Member
You can compile your java program into a native windows .exe file using Excelsior JET.
<http://www.excelsior-usa.com/jet.html>
Excelsior JET also converts the entire java API into native .dll files which your .exe file will need inorder to run.
You could also write a launcher in a native language which starts the JVM and runs your program. You could also put your .class files in a jar archive. You can run programs in jar files by double clicking in windows.
Also...........
You can download JtoExe here:
<http://home.javaarchives.com/development_-_java_2.html>
Last edited by Dilenger4; Nov 8th, 2002 at 04:22 PM.
-
Nov 14th, 2002, 07:02 PM
#8
Hyperactive Member
what star office and forte do is just make an exe all it does is invoke the jvm and plas a certain class to it. you can also use jar files which package all the files into one (like a linux tar/gz ball), you can execute a jar just by dbl-clicking the jar. or if you want you could make a perl or python file that calls the jvm too and you could just dbl-click those and they would also be cross platform but would require that ppl havea a perl and python interpreter which almost all computers do anyway
"There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein
If you are programming in Java use www.NetBeans.org
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|