# [NEW]Can't open .jar files?



## Eterna1 (Sep 6, 2012)

I have tried so many different solutions that I've researched through google and nothing seems to have worked. 


I am running windows 8 64 bit os.

My registry entry points to the right place, the entry exactly is:
C:\Program Files (x86)\Java\jre7\bin\javaw.exe -jar "%1" %*


I know the java I am using is for an 32 bit os but if you really think it will make a difference I can put the 64 bit back on. As a last resort I tried uninstalling the 64 bit java and installing the 32 bit java to see if it would make any kind of a difference and it made zero. I still have the same exact experiences regardless of what I try.

When I try to open the .jar file through explorer for a very brief second the mouse turns into the loading circle then back to the mouse as if it *was* loading something but nothing ever opens. When I try to open the file through command prompt I don't get an error but it just repeats the directory name I am at on a newline awaiting new input.


The .jar file is a very simple java program made in netbeans that runs fine through netbeans.



I am at a loss as to what else I can try. Please help.


----------



## Masterchiefxx17 (Feb 27, 2010)

*Re: Can't open .jar files?*

If you want to open jar files you need a program such as 7Zip or WinRAR.


----------



## Eterna1 (Sep 6, 2012)

*Re: Can't open .jar files?*

I'm trying to run the program I made outside of netbeans to see what it looks like and how it runs. I'm not trying to unrar or unzip anything...


----------



## Masterchiefxx17 (Feb 27, 2010)

*Re: Can't open .jar files?*

You can edit .JAR files with 7Zip or WinRAR.


----------



## Eterna1 (Sep 6, 2012)

*Re: Can't open .jar files?*

I am not trying to edit the jar file.


The jar file is a program I wrote in netbeans. It is simple as a hello world program. It has no errors and compiles and works in netbeans. I was trying to run it anyway possible outside of netbeans. I tried using a jar2exe program, one of them was called jsmooth but couldn't get it to work and I don't know why. Perhaps we can explore that after I get a solution to this problem. 

I am simply trying to use whatever file from the compilation process possible to run/view and test the program. From what I understand, the file from the compilation process needed to test a written program outside of the netbeans program is the .jar file. From the research I did, as long as I have the the java runtime environment the project should be able to be run using one of the compilations files (the jar file) outside of netbeans. This is what I am trying to do.


----------



## Masterchiefxx17 (Feb 27, 2010)

I've moved this thread to programming hopefully they will have a better answer.


----------



## Special2God (Oct 5, 2009)

Ok, what happens when you type

```
java -?
```
 in command line. Is java recognized as a valid command? 
To run a jar the command should be

```
java -jar "PATH_TO_JAR_FROM_CURRENT_LOCATION"
```
. 
If you are already in the folder containing the jar you can just type the name of the jar after -jar. 

From your other posts I believe you already know about how to run a jar, but I just wanted to be sure. 
So you said when you run from command line there is a newline and then the current directory pops back up awaiting input. Strange problem, Java should always throw an error if it cannot run a .jar or .class file. 

To be sure Java is being run correctly, check the following two things:
1. The Windows path variable which can be found by typing

```
echo %path%
```
 in command line. If the ';' separated list of values displayed does not contain the path to your Java installation (normally C:\Program Files\Java\jreX\bin where X is some version of java) then check the second option. 

2. Check "C:\Windows\System32", sometimes Java places a copy of itself (java.exe) here so that users don't have to edit their environmental path variable. 

If java.exe is not in either location, then there is some other strange issues probably related to the registry. 

Also, since netbeans runs your project fine, you could trying using the command line to change directories into your JDK directory (probably in C:\Program Files\Java\jdk1.7.0_XX where XX is some version) and run

```
java -jar "ABSOLUTE_PATH_TO_JAR"
```
 using the JDK rather than the standard JRE.


----------

