Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] *.java to *.exe

Started by cpp_boy Feb 12, 2005 at 2:47 PM 19 replies 4.4k views
Original Post
cpp_boy
cpp_boy
Hello. I"m working now on little project and I have a little problem. I must convert few "*.java" files into windows "*.exe" files. (I mean that after this conversion of java file I get .exe file that will run on any windows machine without JVM ). THANKS [Edited by - cpp_boy on February 12, 2005 3:34:32 PM]
yaroslavd
yaroslavd
You can't. There are some 3rd party programs that let you do that, but I heard they got problems. What you probably want to do is make a .jar archive. Then, you can double-click on it and it will open the program, which is probably what you want.
H_o_p_s
H_o_p_s
Or use a exe wrapper. The only problem would be that they would still need the JVM...
BRING BACK THE BLACK (or at least something darker)
Foxostro
Foxostro
*.java files are just the java source code, similar to *.c or *.cpp files in function. To turn them into a java application you're going to need a java compiler. Personally, I like the BlueJ IDE, but I know people who would rather use NetBeans, so look around for an IDE that suits you. Java is a cross platform language that runs off of a "virtual machine" on the platforms that support Java. Generally, you would embed Java into an HTML document and have a web browser start the Java application when the HTML page was opened. You could look into Java Web Start if you wanted to package a Java App that could launch itself.

Hope this helps.
cpp_boy
cpp_boy
Quote:
Original post by Foxostro
*.java files are just the java source code, similar to *.c or *.cpp files in function. To turn them into a java application you're going to need a java compiler. Personally, I like the BlueJ IDE, but I know people who would rather use NetBeans, so look around for an IDE that suits you. Java is a cross platform language that runs off of a "virtual machine" on the platforms that support Java. Generally, you would embed Java into an HTML document and have a web browser start the Java application when the HTML page was opened. You could look into Java Web Start if you wanted to package a Java App that could launch itself.

Hope this helps.


I want my java file to run on windows machine without any JVM. Just regular ".exe" file. I dont want to use J# compiler cos its crap.
So maybe there is some other method to compile java file into windows executable file .
tombr
tombr
There is Excelsior JET:
http://www.excelsior-usa.com/jet.html
,but it costs money.

Then there is the free gcj: http://gcc.gnu.org/java/

Both will probably have their issues. In particular if you use awt.

You could also include the jre with your application if you don't mind adding 15MB to it.

Or even better, stick with c++.
Raghar
Raghar
Using statical compilation kinda limits life of your application. Standard .jar files would jump in speed on multicores, and with new instrucitons sets, statically compiled ones would just be buggy and crawl. The only advantage would be if your user would expect exe because he didn't experience anything different, and you are unable to educate him a little.
Then wrapper, or link on desktop would do wonders.
cpp_boy
cpp_boy
Thanks a lot everybody.
I will try "Excelsior JET". If it's OK, maybe I"ll even purchase one.
capn_midnight
capn_midnight
Quote:
Original post by cpp_boy
Thanks a lot everybody.
I will try "Excelsior JET". If it's OK, maybe I"ll even purchase one.

excelsior JET still uses the wrapper exe method for anything involving a AWT or Swing. If these applications are just command line stuff, then you will be fine, it will compile to a straight exectuable. Otherwise, the user will still have to install a JVM.
H_o_p_s
H_o_p_s
There is a way in JSmooth to include the JVM/JRE within the application. The only problem with this is that it is 15mb bigger, and of course isn't cross platform, and doesn't get updated with new JVM updates...
BRING BACK THE BLACK (or at least something darker)
capn_midnight
capn_midnight
Quote:
Original post by H_o_p_s
There is a way in JSmooth to include the JVM/JRE within the application. The only problem with this is that it is 15mb bigger, and of course isn't cross platform, and doesn't get updated with new JVM updates...
all of those aren't as important as getting people to actually run your program.
cpp_boy
cpp_boy
Tell me please, is it legal to sell my software with JVM (in one package)???
bastard2k5
bastard2k5
From Sun's JRE 5.0 license:
Quote:

B. License to Distribute Software. Subject to the terms and
conditions of this Agreement and restrictions and
exceptions set forth in the Software README file,
including, but not limited to the Java Technology
Restrictions of these Supplemental Terms, Sun grants you a
non-exclusive, non-transferable, limited license without
fees to reproduce and distribute the Software, provided
that (i) you distribute the Software complete and
unmodified and only bundled as part of, and for the sole
purpose of running, your Programs, (ii) the Programs add
significant and primary functionality to the Software,
(iii) you do not distribute additional software intended to
replace any component(s) of the Software, (iv) you do not
remove or alter any proprietary legends or notices
contained in the Software, (v) you only distribute the
Software subject to a license agreement that protects Sun's
interests consistent with the terms contained in this
Agreement, and (vi) you agree to defend and indemnify Sun
and its licensors from and against any damages, costs,
liabilities, settlement amounts and/or expenses (including
attorneys' fees) incurred in connection with any claim,
lawsuit or action by any third party that arises or results
from the use or distribution of any and all Programs and/or
Software.
cpp_boy
cpp_boy
THANkS. This was very helpful. And I must admit, that JAVA is real fun ;)
capn_midnight
capn_midnight
Quote:
Original post by cpp_boy
THANkS. This was very helpful. And I must admit, that JAVA is real fun ;)
no it's not. it's a pain in the ass.
Luckless
Luckless
Quote:
Original post by capn_midnight
Quote:
Original post by cpp_boy
THANkS. This was very helpful. And I must admit, that JAVA is real fun ;)
no it's not. it's a pain in the ass.


someone didn't take a coruse in Java and get "Java is Great" drilled into their head by the instructor.

Java is great, for what its good for.
Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
falkone
falkone
Quote:
Original post by Talroth
Quote:
Original post by capn_midnight
Quote:
Original post by cpp_boy
THANkS. This was very helpful. And I must admit, that JAVA is real fun ;)
no it's not. it's a pain in the ass.


someone didn't take a coruse in Java and get "Java is Great" drilled into their head by the instructor.

Java is great, for what its good for.


Java's great if you're willing to do it Java's way. Sometime's it's a pain in the ass. It's elegant for complex projects.. but I keep expecting it to collapse in on itself like a dying star.
Disclaimer: "I am in no way qualified to present advice n any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)" o
Raghar
Raghar
Quote:
Original post by capn_midnight
Quote:
Original post by cpp_boy
THANkS. This was very helpful. And I must admit, that JAVA is real fun ;)
no it's not. it's a pain in the ass.



It seems for this very reason I'm writting a new video codec in Java.

Naw you are trolling. I'm sometimes worried what school instructors will do with Java name. Stupid teacher, or wrongly designed lesson, and students would get: bad background, distaste for Java, or any form of programming, or they would get "is API for that then I'd do it" abilities. Luckily they are teaching C# as well. (So flood of students like this: The teacher asked us to write a program that would count all even numbers from 0 to n. How can I do it? Could you write a source code for me? Would hit other new languages as well.)

capn_midnight
capn_midnight
No, I program in Java all the time. In fact, it's almost exclusively. I'm considered by my professors to be a very good programmer and computer scientist. It's still a pain in the ass.
Raghar
Raghar
Ever tried C compiler that required maximal length for variable, or funcion name to be at most 8 characters long?
Creating somethin complex elsewhere than Java could be pain in the ass.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.