Sign in to follow this  

[java] *.java to *.exe

This topic is 4681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
*.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.

Share this post


Link to post
Share on other sites
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 .

Share this post


Link to post
Share on other sites
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++.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by cpp_boy
Tell me please, is it legal to sell my software with JVM (in one package)???


A more user-friendly answer would probably have been just to have said:

"Yes"

...so long as you don't modify the JVM itself, and include any relevant "blah blah this includes some code that belongs to sun blah blah" copy/paste text.

However...purists will probably hunt you down with dogs for doing it, since it *defeats 1/3rd of the purpose of the existence of java*...unless you are also distributing your java apps the way they are supposed to be distributed.

redmilamber

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this