Ewan
Ewan

Reputation: 357

Where is the Java "jar" function

I'm looking to make a jar file out some Java code using jar [options] [name] [files] from the command line but it's not recognized.

According to Oracle Jar is part of the JDK. I have both 7 and 8 installed. How do I run the jar function?

I don't have a C:/Java that the Oracle documents show. I've tried running jar from within the JDK directories and with admin rights.

I'm not putting params in yet, want to check I can at least find the jar function first.

Running jar from JDK directory Running jar from JDK directory(1.8) http://puu.sh/eoer7/4fcd0ce63c.png Running jar from System32 http://puu.sh/eoe3X/076d79b4e4.png

Upvotes: 0

Views: 235

Answers (1)

Elliott Frisch
Elliott Frisch

Reputation: 201447

You have displayed two installations of the Java Runtime Environment (or JRE). You need to install a Java Developer Kit (or JDK), to get jar. Set your JAVA_HOME to the installation directory of the JDK, and add it to your PATH.

set "PATH=%PATH%;%JAVA_HOME%\bin"

Also, Using JAR Files: The Basics says (in part) JAR files are packaged with the ZIP file format, and you can use tools that can read and write ZIP files to work with them.

Upvotes: 5

Related Questions