0

I wanted to use java commands so I searched a lot in the internet. What I found was to make a new user variable with the name PATH and value %PATH%;C:\Program Files\Java\jre7\bin . After restarting I wrote in cmd: java and it showed:

Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -d32 use a 32-bit data model if available -d64 use a 64-bit data model if available -server to select the "server" VM -hotspot is a synonym for the "server" VM [deprecated] The default VM is server. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A ; separated list of directories, JAR archives, and ZIP archives to search for class files. -D<name>=<value> set a system property -verbose:[class|gc|jni] enable verbose output -version print product version and exit -version:<value> require the specified version to run -showversion print product version and continue -jre-restrict-search | -no-jre-restrict-search include/exclude user private JREs in the version search -? -help print this help message -X print help on non-standard options -ea[:<packagename>...|:<classname>] -enableassertions[:<packagename>...|:<classname>] enable assertions with specified granularity -da[:<packagename>...|:<classname>] -disableassertions[:<packagename>...|:<classname>] disable assertions with specified granularity -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions -agentlib:<libname>[=<options>] load native agent library <libname>, e.g. -agentlib:hprof see also, -agentlib:jdwp=help and -agentlib:hprof=help -agentpath:<pathname>[=<options>] load native agent library by full pathname -javaagent:<jarpath>[=<options>] load Java programming language agent, see java.lang.instrument -splash:<imagepath> show splash screen with specified image See http://www.oracle.com/technetwork/java/javase/documentation/index.html for m ore details. 

Then I typed in cmd: jar and it showed:

'jar' is not recognized as an internal or external command, operable program or batch file. 

Why does it recognised the first command but not the second one?

My operating system is Windows 8 64bit.

2 Answers 2

1

jar.exe is part of JDK not JRE. Point path to JDK 7.


Just go to the path C:\Program Files\Java\jre7\bin and search for jar.exe. You will never find it there.

The first comment java works fine because java.exe is present in JDK and well as JRE.

Sign up to request clarification or add additional context in comments.

1 Comment

You're welcome. Please visit tour of StackOverflow.
1

Because the jar command ships with the JDK, and not with the JRE. Install a JDK and add it to your PATH.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.