-3

I've searched for a while for a fix, I think I've tried all of the common fixes, I even tried Jarfix. I have JRE installed, and I deleted and reinstalled it again just to make sure, I'm running Windows 10 64 bit. If I double click the .jar just nothing happens, and I've made sure that .jar is set to open with the right file. I don't know what to try so if you have any suggestions, I'll try them, because I'm completely lost.

Whenever I try to run any command starting with "java" is gives me this: 'java' is not recognized as an internal or external command, operable program or batch file.

  • 2
    Does this answer your question? [How to run a JAR file](https://stackoverflow.com/questions/1238145/how-to-run-a-jar-file) – vaibhavsahu Aug 30 '21 at 21:25

2 Answers2

1

First of all, Add your JRE to the PATH of Windows. When you add it there, running java commands in the command line, will be recognized since JRE will also be indexed.

This is how you add it:

set PATH=%PATH%;C:\your\path\to\jre\bin\here

An example:

set PATH=%PATH%;C:\Program Files\Java\jre1.8.0_271\bin

Then go to the folder where your jar file is located. And open a command line there.

Or go there through the cd command (which means change directory to jump to exactly this directory). Example:

cd C:\Program Files\Java\jre1.8.0_271\bin

And then run your jar this way:

java -jar yourJarName.jar
Renis1235
  • 4,116
  • 3
  • 15
  • 27
  • when i tried to run the jar, i got this ```C:\Users\daaaw\Desktop\jar> java -jar backpacked-1.10.1-mc1.16.3.jar no main manifest attribute, in backpacked-1.10.1-mc1.16.3.jar``` – PaintedRoses Aug 31 '21 at 16:27
  • Good news, your java installation works. Now you have a complete other problem... is this jar compiled by you? – Renis1235 Aug 31 '21 at 19:30
  • no, it is not, :1 – PaintedRoses Aug 31 '21 at 22:02
  • From googling I see that this jar is a Minecraft mod. This jar does not have a `main` function. Meaning that this jar was not meant to be run... I do not know how minecraft mods can be installed/put to use. That you have to research yourself. – Renis1235 Sep 01 '21 at 07:10
0

.jar files have the java directory directly inside of them so you shouldn't have to reinstall JRE.

Maybe your .jar file you are trying to run isn't put together properly.

OR there is nothing to run on your file or there is an error in the code.

Those are all ways it could be broken.

msnba
  • 1
  • 1
  • could be, but so far every .jar file I've tried has had the same issue, another thing I've thought of is if the version of java could have something to do with it, right now I have the latest version of JRE, and I didn't think .jar files could be version locked to where certain .jar files could only be opened with certain versions of java, but I could be wrong. thoughts? – PaintedRoses Aug 30 '21 at 22:24
  • the jar files already have the java version built into them. – msnba Sep 03 '21 at 21:50