0

I have downloaded a .jar file and it won't run on my computer. I have installed Java RE 5.0 and have Java 7 update 72. Every time I double click on the file it pops up and closes.

I have reinstalled the java re and java 7u72 and still no success.

Any help with running executable .jar file on windows 7?

Lucas
  • 1
  • 1
  • 3

3 Answers3

0

The .jar file must have a lib folder in the folder the .jar is in to open a window (without using native java libraries). If it doesn't, then the .jar won't open any windows, as it needs external libraries to do so. However, if your .jar isn't meant to open any windows, then it has been performing as expected. Try running your .jar from the command line:

java -jar <jar-file-name>.jar
Tetramputechture
  • 2,911
  • 2
  • 33
  • 48
  • What if it uses the java.awt package to create the widow? – dramzy Oct 15 '14 at 16:03
  • You're right, but I don't know what his jar file uses, so I just assumed he was using outside libraries and that's why his .jar wasn't opening anything. Edited. – Tetramputechture Oct 15 '14 at 16:05
  • my jar file is used for a firewall virtualization tool so it is just one executable file that is supposed to open I don't know about any libraries or package @Tetramputechture – Lucas Oct 15 '14 at 16:51
  • It seems to me that your jar should open a window. Does your code actually do so? If it does open a window, does it use native java libraries or external libraries? If external, does the folder the .jar resides in have a `lib` folder? If not, there should be one. – Tetramputechture Oct 15 '14 at 16:54
  • when i double click on the file a window briefly pops up and then closes quickly. There is no folder just an executable file @Tetramputechture – Lucas Oct 15 '14 at 17:06
0

Have you checked the Environment Variables? Maybe the variable PATH is not specified. Besides, you can try this:

Start - "Control Panel"
Click on "Default Programs"
Click on "Associate a file type or protocol with a specific program"
Double click on the .jar
Browse C:\Program Files\Java\jre7\bin\javaw.exe
Click on the button Open
Click on the button OK

If it doesn't work, try to configure the Environment Variables:

From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

Note: You may see a PATH environment variable similar to the following when editing it from the Control Panel:

%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem

Variables enclosed in percentage signs (%) are existing environment variables. If one of these variables is listed in the Environment Variables window from the Control Panel (such as JAVA_HOME), then you can edit its value. If it does not appear, then it is a special environment variable that the operating system has defined. For example, SystemRoot is the location of the Microsoft Windows system folder. To obtain the value of a environment variable, enter the following at a command prompt. (This example obtains the value of the SystemRoot environment variable):

echo %SystemRoot%

More info here

Hope it helps.

Clemencio Morales Lucas.

0

By default, java does not run in windows mode, maybe it's just a console java program.