aspose file tools*
The moose likes Java in General and the fly likes confusion about jar files . Please help me out. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "confusion about jar files . Please help me out." Watch "confusion about jar files . Please help me out." New topic
Author

confusion about jar files . Please help me out.

Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
HI
is JRE a part of the Os(win or linux) ? if yes then can an executable jar file(provokes on double click) comprising of a swing application(compiled in jdk1.4) run if there is no jdk on the system ?
Not sure . Never tried
Can you guide me a bit
Thanks in advance
[ May 08, 2003: Message edited by: raghav mathur ]

Raghav.
Gopi Balaji
Ranch Hand

Joined: Jan 23, 2003
Posts: 84
Originally posted by raghav mathur:
HI
is JRE a part of the Os(win or linux) ? if yes then can an executable jar file(provokes on double click) comprising of a swing application(compiled in jdk1.4) run if there is no jdk on the system ?
Not sure . Never tried
Can you guide me a bit
Thanks in advance
[ May 08, 2003: Message edited by: raghav mathur ]

JRE can be considered as an (restricted) extension of the OS.
The active presence of a JRE is sufficient for a Swing application to run, the presence of JSDK is not necessary.
-GB.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Some operating systems come with a JRE and some not. Of course YOU will have no idea what VERSION the user has. Many application folks include a version of the JRE with their application build just to be sure that
1. It exists on the machine
2. It is the version that the application was written to.
There are tools out there that can assist in deciding such thing. For instance InstallSheild an InstallAnywhere are tools to create executables for the purpose of deploying your application. They can be configured to go LOOK to see if the correct JRE is there and if not prompt the user to have it installed for them.
But where I work we usually just include a copy of the JRE with our build anyway. Insurance you know.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
HI Cindy
How do i bundle my jar file with the jre . i need to upload this file to a site from where it can be downloaded by users .
What should i do exactly ?
Thanks a ton in advance
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
Do i need to make a setup or someting through which i load the jar file as well as the JRE on the users system . IF yes then how can i achieve this. Are you some sort of tools used to solve such probs ?
PLease guide me a bit
Thanks a ton in advance
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
i,am still waiting for a response
Thanks in advance
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Depends. You could include all the jar files in a self extracting executable and then make sure that you set the classpath to include the JRE jars when you invoke your application. Perhaps by invoking your app with a .bat or .sh file that names the classpath. However that would make the installation OS specific.
Of course if you use one of the tools that I mentioned above it will also create a downloadable module, but will probably be more efficient and robust than what you can put together.
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
Originally posted by Cindy Glass:
Depends. You could include all the jar files in a self extracting executable and then make sure that you set the classpath to include the JRE jars when you invoke your application. Perhaps by invoking your app with a .bat or .sh file that names the classpath. However that would make the installation OS specific.
Of course if you use one of the tools that I mentioned above it will also create a downloadable module, but will probably be more efficient and robust than what you can put together.


i,am not fully sure if i understood what you are saying . What i have understood is that i can bundle all the jar files ( my own applications ) and the JRE jar files together and form a .BAT file from where the JRE would get loaded when the pplication would run as well my own application . IS that the case . If yes then please if you could tell me the steps forexecuting the task you are mentioning.
Please guide me a bit
Thanks in advnace
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
No, you could bundle your app jar files, and the JRE jar file, and any property filed AND a .bat file to invoke the app. The .bat file would be included in the bundling.
Use a tool to get these all into an executable (.exe) appropriate for downloading from a webpage or copying to a CD or whatever. Of course you would need a separate one for each target platform this way.
Such an executable will then install all the stuff where it should go.
When you WRITE the .bat file to include in the above executable, make sure that it specifically names the classpath of the JRE that you had installed. You can do this either by adding the -cp parameter to the call to the java.exe or you can just prepend your classpath onto the current classpath. You will also want to prepend the bin directory to the path setting so that you get the JVM that you are expecting.
Do a search for .bat on this forum and the beginner forum. There are lots of posts that explicitly show what the code in such a bat file would look like.
Step one: Buy InstallSheild . . .
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
HI
I have a created a run.bat file which looks like this :
java -classpath test.jar Test
path C:\WINDOWS\Desktop\testfolder\mysql-connector-java-3.0.7-stable-bin.jar
now my test.jar would not run as it is not able to find the drivers . I have the jar file for the driver in the same directory and have included that jar file(mysql-connector-java-3.0.7-stable-bin.jar) in my path variable of the run.bat.
Still my test.jar doesn't work
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: confusion about jar files . Please help me out.