• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.jar or .exe

 
Forrest Xu
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
an executable file is .jar for Java. but we normally use .exe file.
How can I do that?
one option is that c++ code includes "SHELLAPI.H".
any other option?
thanks,
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Forrest Xu
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also make jar-files "double-clickable" by providing a manifest. See http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html - especially "Applications bundled as JAR files"
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Forrest Xu
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Tom Purl
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dirk Schreckmann
Sheriff
Posts: 7023
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic