The best way to make a Swing Application or and JAVA app executable is to use JAR files. java.sun.com has a tutorial on making JAR files. Currently, there is no solid way of making an EXE out of a group of CLASS files. Someone may tell you that Symantics IDE allows you to do this, but I have looked at the IDE and have not seen a way. ------------------ Happy Coding, Gregg Bolinger
Hi, In the absence of making Windows executables (which detract from the cross-platform nature of Java anyway) I tend to just use a batch file to start my Java apps on Windows, than all you have to do is double click to run it. eg: save following as "myapp.bat" or whatever...
I think it sort of defeats part of the objective to avoid using the Virtual Machine doesn't it? Why not just code in C++ or something platform specific? regards, Ben
SCJP 1.4, www.gsi3d.org.uk
posted 19 years ago
From my experience a lot of windows users have difficulty in running java apps. I would like the option to distribute without the jvm for windows. I use Java for it's cross platform abilites for server side applications (write on windows - run on unix) - but I would like platform specific options for desktop applications.
There are currently only three ways of producing an exe ( that I know of... ) :
Translation to C/C++ - the Gnu Java compiler works this way. Unfortunately, I think it is for Unix only and doesn't support some of the newer stuff like Swing...
Wrapping everything together - Most of the java "compilers" packaged with IDEs work this way. They don't really compile the class... all they do is have a small JVM, add all the classes as resources to it, and have the exe launch the JVM inside it with the classes specified.
Other ways - Some other high end ( i.e. really expensive ) Java compilers do other things to get a java executable... unfortunately, most don't put the details of how they accomplish this on their web sites, and are too expensive for me to try out...
From my experience a lot of windows users have difficulty in running java apps.
LOL!!! That's because a lot of windows users are stupid...
Why not include the JRE with your app? It'll make the download a little bigger, but at least you'll know that the user will have an up-to-date JVM... then just include a .bat file like Ben suggested above for the icon on the desktop to start it up...
I've heard that InstallShield works pretty good for this type of thing...
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Ok, there are a few decent JAVA to Binary converters out there. They are, for the most part, pretty expensive. Basically, what they do, it compile all the JAVA class files that come with the JDK to a type of DLL. Then they compile your class files to an EXE but take all your library imports and include them as DLL's in the package that you would release and distribute. As far as I know they work pretty good, but like I said, they aren't cheap.
You don't really have to install the JRE, just include it in a subdirectory with your application. Then, create a batch file that launches your app using the subdirectory, and includes the -Xbootclasspath variable to specify the location of the system class files. batch file start command: ./jre/bin/java -Xbootclasspath:./jre/lib/rt.jar <application>