It's not a secret anymore!
The moose likes Beginning Java and the fly likes JAR file problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JAR file problem." Watch "JAR file problem." New topic

JAR file problem.

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

I have Win XP SP2 with JDK 1.6 installed with proper path setting.My problem I have created an executable JAR file and it working fine in another PC with same coniguration(XP2 and JDK1.6),but in my when I double click the JAR file,it displays that:-

Wndows cannot open this file:
Use the web service to find the approprate program

Select aprogram from list

But non of the program from the list would open it correctly.But I saw in the program list of that other PC has a program called:-Java(TM) Platform SE binary ,but this program is not in the program list in my PC.

Please,give me any idea to run JAR file in my PC.

Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2904

The program is actually a JRE running which opens the executable .jar file,

the only solution I see is try to reinstall JDK1.6, it helps !

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46362
Have you downloaded and installed a JRE? Download page here.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20274

The file association that will make sure javaw.exe is called when a JAR file is executed is missing or broken. You can fix it yourself, but (re)installing the JRE / JDK as Sagar and Campbell suggested should solve the problem.

Actually, my guess is that Campbell is right and you don't even have the JRE installed on your PC. That would of course also explain why the file association is missing.

How To Ask Questions How To Answer Questions
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
And if you have got the JRE installed, but the program still doesn't appear in the list, then there is a Browse button just below the list that allows you to select other programs.

Ashok Pradhan
Ranch Hand

Joined: Dec 17, 2007
Posts: 180

I know that if I reinstall JDK it may work.I think reinstalling the JDK is not the only solution.first I want to know which program(the file from bin derectory,javac,javaw,jar...) is responsible to executing JAR files.,but I have tried opening the JAR file with java,javaw,jar, but it does not working.If any any other option is left then suggest me,because if I give my JAR files to my friends and JRE is installed in their PC but they couldn't run my apps then it is not fair to tell them to install JRE
again and again tiil it work.

In my PC if I execute The JAR file in command prompt it works:-

D:\>java -jar DigWatch.jar

Thanks Sagar,Campbell,Rob and Joanne !!!
[ July 25, 2008: Message edited by: Ashok Pradhan ]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46362
You have already said you couldn't find a java.exe on the 2nd PC, so you will have to install at least the JRE on that machine. Any computer would require a JRE to execute any Java files.
I agree. Here's the link:
subject: JAR file problem.
jQuery in Action, 3rd edition