• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

making a .java file .exe

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi there,
I am sure this is a simple (or silly) question. I have just written a GUI as a java application. It works fine if I launch it from the command prompt in Windows. Is there a way of converting the .java file to a Windows executable (.exe) file? ie. so that a user can double click on a Windows .exe file icon to launch the java app?
Muchos Gracias
Alan Watts
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think we can make an .exe from a .java file. But you can do one thing, write a batch file with instruction to run the java byte code (i.e. java MyClass).
Hope this helps,
Gautam.

------------------
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know, there are three things you can do...
1 - Have the installer (if you use an installer) create a shortcut on the desktop or in the start menu somewhere that executes the same thing your command-line instruction would be. It looks the exact same, and you don't have to mess with really compiling the code into an *.exe. Java was never intended to fully compiled, as far as I know...which is the whole point of cross-platform portability. Use a shortcut, that's why they're ther
2 - You could write a *.bat file and either put that up on the desktop (with a better icon, I'd hope) or write a *.bat file and then make a shortcut on the desktop or start menu to that *.bat file. For progs that need a more complicated startup command, then I think this is the way to go...
3 - You could go find the *.java/*.class to *.exe compiler. It is out there somewhere, but it's 100% not made by Sun...so once you make your program into an *.exe, you're out of the loop, so to speak. It can never be transferred to a Linux or Sun system accept through X Windows...and that sucks. The compiler is an open-source project, and if you're REALLY looking to make the prog into an executable, then this is the only way I know of. There is absolutely NO reason to do this, however, unless you are doing it strictly to improve execution time (which is does by eliminating the JVM overhead). From what your situation sounds like, this isn't the way to go.
I am absolutely not an authority on Java or Windows... so if some local guru wants to tell me I'm wrong, go right ahead! I have messed with the *.bat files and the shortcuts porsonally, and they work just fine. The shortcut-to-*.bat is exactly the method that the jEdit editor works, by the way... http://jedit.sourceforge.net
Take a look at the project and see what you think about their startup method... no *.exe here. Just *.bats and an optional shortcut. That way everything stays inside of *.jar files or *.class files and Linux, Sun, Windows, etc people can all play with it.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Alan, yes, its possible to make an exe. Just go here: http://www.excelsior-usa.com/jet.html
download the trial version and read the help file to find out how to use the utility. Seems to work pretty well for me.
 
Alan Watts
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Many thanks to all the respondents for their quality advice.
Hopefully, in time when I am wiser and greyer I can contribute usefully here as well.
Cheers
Alan Watts
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alan,

You could make an exe file but if you want this to run on many platforms creating an exe will not do you any good.
You can create a windows shortcut and set the target:
c:\JDK1.3\bin\java.exe TestFile
*you might have to specify TestFile.class
and set the start in dir to where TestFile is located.
I hope that works for you.
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wiser! Did you hear that guys? Wiser, I kinda LIKE that.
But enough with that GREYER stuff. Really, that is no way for a gentleman to talk. .
I, of course, am MUCH to young to have to worry about things like grey (snicker).
Sure glad that I wasn't who you were refering to .
[This message has been edited by Cindy Glass (edited June 07, 2001).]
 
Alan Watts
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Just call me Daddy...
 
Kirill NKaufmann
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ahahahah
 
Kirill NKaufmann
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and anyway if you make an exe using JET u will have to include a bunch of large JET dll's in order to run your exe elsewhere so it kinda defeats its own purpose, still worth a try though.
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This probably isn't the route you're looking for, but MS Visual J++ and Symantec VisualCafe will allow you to compile a project into an exe.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic