Forums Register Login

JRE Question

+Pie Number of slices to send: Send
I have a Java app and made a jar file from it. Now I want to deploy the app on a machine which will not necessarily have the JRE installed.
Is installation of the JRE on the client necessary or can I somehow add the JRE to my jar file and have everything the app needs in a single JAR.
That would be much better.
Thanks in advance for anybody's help here.
Rob
+Pie Number of slices to send: Send
Unless the JRE is already installed, the system won't know what the heck a .jar file is.
Some of the big name java installation program generators (like InstallAnywhere and friends) can optionally include a JRE that is transparently installed in the setup process.
That's about all I can say.
+Pie Number of slices to send: Send
Is there any way to get the JRE into the jar file without an installation program like the ones you have mentioned.
It seems like it would be something that everyone would want.
+Pie Number of slices to send: Send
Putting a JRE into a Jar file is trivial. A Jar file is just a zip file with a manifest. But, as David pointed out, the target machine won't know what to do with it.
--Mark
+Pie Number of slices to send: Send
Mark,
Thanks for your reply. I understand.
What is the preferred why to distribute a Java app? Should it be up to the user to get and install the JRE (doesn't sound good to me) or should some third party install program be used?
What is the most common method? Obviously distributing Java apps is done all the time, I just have no experience here to know the answer.
Appreciate your help.
Rob
+Pie Number of slices to send: Send
Well, some choices are:
1 - Bundle the JRE with your app. Have the user download this into a specific directory. Then create a .bat file or .sh file to invoke the app. This allows you to point to your JRE in the classpath inside the bat file. It also means that the target machine does not need a mime type set up that knows what to do with a file with a .jar extension.
2 - Buy a tool (InstallSheild is what we use) that will bundle the JRE with your app and create a self-extracting executable for the target platform.
3 - Have an Install Web Page that talks the user through doing their own download of the JRE and (for some OS's) setting up a classpath and mime type.
+Pie Number of slices to send: Send
 

Originally posted by Cindy Glass:
Well, some choices are:
1 - Bundle the JRE with your app. Have the user download this into a specific directory. Then create a .bat file or .sh file to invoke the app. This allows you to point to your JRE in the classpath inside the bat file. It also means that the target machine does not need a mime type set up that knows what to do with a file with a .jar extension.
2 - Buy a tool (InstallSheild is what we use) that will bundle the JRE with your app and create a self-extracting executable for the target platform.
3 - Have an Install Web Page that talks the user through doing their own download of the JRE and (for some OS's) setting up a classpath and mime type.


Thanks Cindy!
For option #1, if I put the JRE and app into a jar file and then write a shell that sets the classpath appropriately and calls the app as follows:
java -jar app_jre.jar
How will the machine know about the "java" command?
I am still a bit confused.
Appreciate the help,
Rob
+Pie Number of slices to send: Send
Well, frankly I would just zip that stuff all together and have the user unzip it into the specified directories.
You would need to concatenate the subdirectory that will hold the java.exe into the path. Then you can just invoke the application specifying the classpath using the -cp option.
You really don't even need to use the -jar option if you fully qualify the class with the main in it.
>path .;c;\whatever;%path%
>java -cp whatever myApp myProperties.properties
Here is a .bat file that we use:
******************************************
cd \"Program Files"\myCompany\myApp
path = .;C:\"Program Files"\myCompany\myApp;C:\"Program Files"\myCompany\myApp\jre\bin;
"c:\Program Files\myCompany\myApp\jre\bin\javaw" -classpath .;"c:\Program Files\myCompany\myApp";"c:\Program Files\myCompany\myApp\myApp.jar";"c:\Program Files\myCompany\myApp\deploy.jar";"c:\Program Files\myCompany\myApp\jre\lib\rt.jar";"c:\Program Files\myCompany\myApp\jre\lib\jaws.jar";"c:\Program Files\myCompany\myApp\jre\lib\i18n.jar";"c:\Program Files\myCompany\myApp\classes12.jar";"c:\Program Files\myCompany\myApp\images" myApp.client.myAppDesktop "c:\Program Files\myCompany\myApp\myApp.properties"
************************************************
+Pie Number of slices to send: Send
Got it, thanks again.
+Pie Number of slices to send: Send
Rob, it really depends on your target audiance...
Commercial windows apps should have an installer.
Commercial Unix apps, can use installers or installer scripts.
Academic software is usually installed by hand :-p
Free software can do what it wants.
There's also the JNLP, Webstart option.

Of course, the easier you make it to install, the more people will use it.
--Mark
+Pie Number of slices to send: Send
Mark,
The app is for a real company and should be distributed as professionally as possible.
Seems like an installer would be the way to go for my particular situation. Which installer(s) would you recommend for both Windows, and UNIX.
Thanks,
Rob
+Pie Number of slices to send: Send
I think the best way is to use JavaWebStart, because the user only has to install JavaWebStart(with JRE), and then can click on a link in a website to a file, .jnlp, the only you have to understand is the jnlp syntax (very easy).
For an example look at: http://www.monster-internet.nl/javanote/
Sorry it's in Dutch, and uses XML and XSLT
+Pie Number of slices to send: Send
Java Web Start might be the right answer, but I would still like to hear about which installers are preferred for both Windows and UNIX.
Thanks, link in English next time would be very cool
+Pie Number of slices to send: Send
Still looking for input regarding the most popular installers for Java apps on both Unix and Windows.
Thanks,
Rob
+Pie Number of slices to send: Send
Well, Sun uses InstallSheild. My (rather large) company uses InstallSheild. Try running some of the installation programs that you have lying around on various CDs. You don't have to complete the installation to see who created the Install software.

InstallAnywhere is probably the other big contender.
+Pie Number of slices to send: Send
Sorry, I didn't check back lately. The more common ones are InstallShield and Wise. I've used Wise and liked it a lot. It's very easy to learn and use.
I've also used ZeroG's installer, but found it to have a very poor user interface.
--Mark
+Pie Number of slices to send: Send
Thanks Mark.
"How many licks ..." - I think all of this dog's research starts with these words. Tasty tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1360 times.
Similar Threads
Class not found Exception?
Java Application & Registry
How to check if JRE is installed
package,classpath and servlet
Java on CD-ROM
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:27:07.