If you compile your java code into an .exe then it is NOT platform independant. A better solution is to have a .bat or .sh file to invoke your app. Then only THAT portion is platform dependant. Of course you can just use the .jar file anyway. What do you have against it? [ December 04, 2002: Message edited by: Cindy Glass ]
"JavaRanch, where the deer and the Certified play" - David O'Meara
posted 16 years ago
Thank you for you replay! you provided another option for it. The reason I don't like it is that in window platform the customer always uses mouse to click the executable file to launch the application. jar file needs to enter something by hands. I saw someone's java code, their executable file is exe file. how can we do that if we do not use .bat or .sh? thanks.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
You could also make an EXE file that invokes the VM and calls your main method. That of course is platform dependent, but it is another option. Here is a link on how to invoke the Java Virtual Machine using the DLL that Sun provides with the JDK/JRE.
posted 16 years ago
Here is a link on how to invoke the Java Virtual Machine using the DLL that Sun provides with the JDK/JRE. I think Gregg Bolinger provides the best option. do you agree with that? Thank ALL OF YOU!
I used a couple of java apps and the vast majority of them *don't* use .exe's. Typically, they offer two executable files; a .bat file (for the Windows platform) and a .sh file (for the Linux/UNIX platform). Both files can be executed by double-clicking on them. In the past, my only concern with providing a .bat file instead of a .exe file was that it would confuse the end user. However, after using a few programs that use .bat files instead of .exe files, I found that the average end user sees no difference. So basically, unless you are building a program that is strictly Windows-dependent, build a .bat executable and a .sh executable. This allows more people to use your code. Of course, it all depends on your requirements. Plus, even if your program is Windows-specific, it's gotta be easier to create a .bat file rather than an .exe file.