aspose file tools*
The moose likes Beginning Java and the fly likes clicking on jar icon Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "clicking on jar icon" Watch "clicking on jar icon" New topic
Author

clicking on jar icon

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i have two identical pc's at home: both winXPpro and connected with a home network. All this works fine.
I just installed jvm in my children's machine. I put there a jar file, and at first the icon wasnt the usual (with the A capital letter). I clicked and... nothing. Then asked for me to choose a program to open it.
First i made a bat file and that way i could open the jar.
Then i added jvm to System Path and choosed "java" to open the .jar, but without success either.

What exactly do i have to do in order to have the .jar opening just from clicking on it?
Thanks in advance


java amateur
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I'd guess that your operating system file association for JAR files isn't configured correctly to be able to just double-click on a JAR file to get it to run. Are you familiar with changing file associations in Windows XP?

To do so, open any explorer (that's explorer, not Internet Explorer) window. In the "Tools" menu, select "Folder Options...". In the "Folder Options" window, select the "File Types" tab. If you've already an association for files with the .jar extension, then you may want to edit it; otherwise, create a new one for files with the .jar extension.

On my Windows XP Pro system, for files of with the .jar extension, the default action is named "open", and the application used to perform the action is

"D:\PATH_TO_MY_JRE\bin\javaw.exe" -jar "%1" %*

Use DDE is selected.

You could use java.exe instead of javaw.exe to run your JAR files. With java.exe, the running JAR will be associated with a displayed console window. With javaw.exe, no console window will be displayed.

Success?
[ June 12, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
hi
thanks for your help
i did what you said but i get an error msg saying:
could not find main class. Program will exit
I made the opening program java/.../bin/javaw
dont get it.
I also reinstaled jre.
But if i use my bat file my jar opens ok
What might been happening?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
What do the contents of your bat file look like?
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
just like this:
cd c:\
java -jar Relatorio.jar
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Could you copy and paste the exact contents of your manifest here?

Also, have you looked inside the JAR to double check that the specified main class is present and correctly spelled?

Also, you can email me the JAR file, if you like, and I could just confirm whether it works for me. My email address is dirk AT javaranch DOT com
[ June 13, 2004: Message edited by: Dirk Schreckmann ]
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
my manifest file:

Manifest-Version: 1.2
Main-Class: relatorio.Visual

I'm gonna give it another try when back from work
the jar has 20Mb (has all dependent hibernate files with it) and since it works fine if i start it from command line (in my case form msdos or with a bat file)
i guess maybe some prob with jre because the first install gave an error
Anyway thanks a lot for your interest and help
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i'm even more troubled and puzzled!
at office i've one machine win 2000 server - here the jar works when one clicks on it!
in another machine:winXPPro... its just like at home: cant find main class and only works from commandline/bat file
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I've seen this problem arise on Windows machines with registry configuration problems related to the JRE installation. I have hacked the registry to fix the problem. So, it can be done, but I don't necessarily recommend it. (I recall doing a lot of searching for text such as "1.4" and "1.5").

The problem might fix itself, if you uninstall all JREs and J2SDKs from the machine, and then install one. I'd certainly restart after uninstalling, and before the new installation.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
thanks a lot for your ideas!
i'll certainly try it as soon as i can, and then i'll post back to tell the results... which i hope will be great
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i followed your ideas:
uninstalled jvm,
rebooted,
installed again, BUT the offline version,
now, when that finished, i went to sun java webpage for testing the install (they have an applet to that effect) and the applet woorked ok
Now i tested my jar and....
I'm anxious to get home and try there too
thanks!
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i did it again at home
and worked too
thanks a lot again
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Great!
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
tx!
well, it wasnt without anxiety, because i'd to use the dde trick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: clicking on jar icon