Jar is not recognized as an internal or external command, operable program or batch file

Jar is not recognized as an internal or external command, operable program or batch file
1

Okay, this is probably a very newbie question, but i have been looking online on how to make a jar file and everything i come across says that i use the command

jar cf name.jar name.class

yet, whenever i do this in my command prompt it brings up "'jar' is not recognized as an internal or external command, operable program or batch file." Please i really would like to learn how to do this and i have been trying for a while now. Do i need to type java at the beginning or something? I really am completely lost here.

Sep 11 '07 #1

I'm getting the following error when I try to run the 'jar' command in the command line on windows : 'jar' is not recognized as an internal or external command.

There is a general guess that seems to be right that is I might have the PATH environment variable incorrectly. But I have already done this, I added the following value to PATH variable : 'C:\Program Files(x86)\Java\jdk1.8.0_25\bin'.

I am running a 64 bit windows 8 system.
I have also referenced this question from the following link:
java 'jar' is not recognized as an internal or external command

I have also tried some of the solutions suggested in the above link, I couldnt add a comment there since my reputation is not much.

Suggestions that I have tried from the above link:

[1]https://stackoverflow.com/a/29180681/7639034

(From the above link, java -version and java -jar are also working. What is wrong with the jar file then?)

[2]https://stackoverflow.com/a/42492380/7639034

Jar is not recognized as an internal or external command, operable program or batch file

I am trying to create a jar file and all solution problems lead to setting the environment path to java\bin, which I have done, here is what my environment looks like, http://imgur.com/a/ApNPr and my set path, http://imgur.com/a/ugw5B, any advice would be great thanks guys

Jar is not recognized as an internal or external command, operable program or batch file

level 1

What command are you running?

level 2

jar cf web-app.war index.jsp

level 1

Can you run jar when you're in the directory it is in? Like at the cmd prompt navigate to c:\Program Files\Java6\bin and try to run it from there. Also make sure jar is in that directory.

@VTCer's, I don't really see this as a request for technical support for modded Minecraft. Yes this is a non-vanilla server, but the issue isn't specific to a modded server/game crashes, abnormal behavior, or an error specific to modded games/servers (yes there is an error, but its not a modded game error). If anything, this is more of a general computing question, but considering how tightly coupled Java and Minecraft Java Edition are, I thought this was a good fit for the site. I can see this being a typical problem many users could run into when trying to start a Java server.

Jul 20 at 16:00

How to fix the ‘Java not recognized’ error

Here are the three easiest ways to fix Java’s “not recognized as an internal or external command” error:

  1. Install or reinstall Java and the JDK on your computer
  2. Add Java’s bin directory to the computer’s PATH
  3. Restart the command prompt, terminal window or PowerShell

Jar is not recognized as an internal or external command, operable program or batch file

If the JDK is not installed or the PATH is misconfigured, a ‘Java not recognized’ error results.

Is Java installed?

To run the Java command, first you must have Java installed. This means either the Java Runtime Environment (JRE) or the full Java Development Kit (JDK).

There are many ways to install Java on Windows or Ubuntu Linux. Here are two simple examples.

Install Java on Ubuntu

To install Java on Ubuntu, a single apt install command is sufficient:

sudo apt install default-jre
Setting up default-jre (2:1.11-72build2) ...

Install Java on Windows

To quickly perform a Java install on Windows, download the Adoptium JDK and run the .msi file, selecting all of the default options.

Jar is not recognized as an internal or external command, operable program or batch file

If Java is not installed, you will not be able to fix the ‘Java not recognized’ error.

Add Java to the PATH

You’ll find the Java executable file in the JDK installation’s \bin directory.

If the \bin directory of the JDK or JRE is not added to the Windows or Linux PATH variable, programs may not be able to find it at runtime. This would certainly cause the “Java not recognized” error, even if the JDK or JRE is properly installed.

Jar is not recognized as an internal or external command, operable program or batch file

Make sure Java’s /bin directory is on the path to avoid internal or external command errors.

Restart the terminal window

The terminal window and the command prompt only read environment variables when they first start up.

If the JDK has been installed and the PATH variable set properly, you will still encounter a “‘Java not recognized” error if you did not restart PowerShell or the command prompt.

Restart your terminal window, or the application that needs to find the Java command, and try again. The “Java not recognized” error should go away for good.

Full text of Java error

The full text of the Java not recognized error is as follows:

C:\java-error-fix> java -version 
'java' is not recognized as an internal or external command, 
operable program or batch file.

When Java is installed and configured properly, this error will go away.

How do you fix jar is not recognized as an internal or external command operable program or batch file?

Five steps to solve this problem:.
check whether in your bin folder jar.exe is availbale or not..
check for your environmental setting..
now check for jar it will 100% work..
keep any jar in your desktop and go to desktop path on cmd prompt and run the command jar xf filename. jar..

Why JAR file is not recognized?

If you do not have Java installed, and the PATH variable is not set correctly, attempts to run a JAR file on Windows or Ubuntu will result in a 'Java not recognized' error. To run a JAR file, you must install the Java JDK or JRE on your computer.

How do I fix a JAR file that won't open?

1 -Right click on the jar file and click on Open with and then click on choose another app. 5 – Select java.exe and click OK. If all of the above methods fail, search for jarfix program on Google and download it. This will instantly fix the issue.

How do I run a .JAR file?

To run an application in a nonexecutable JAR file, we have to use -cp option instead of -jar. We'll use the -cp option (short for classpath) to specify the JAR file that contains the class file we want to execute: java -cp jar-file-name main-class-name [args …]