BKK
BKK

Reputation: 1199

jar file making

I am trying to create a jar file with many classes. Using the following command

C:\Users\use\Desktop\SDE_7_SSH\eclipse\new\charge\src\jar> jar cf charge.jar *.class

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

In my jar folder (C:\Users\use\Desktop\SDE_7_SSH\eclipse\new\charge\src\jar), i am having two other folders named "f1", "f2", which inturn having classes.

Upvotes: 1

Views: 191

Answers (3)

sps
sps

Reputation: 372

You need to run the jar command from bin directory. For example on linux system, I would either go to my directory

cd /usr/local/java/jdk1.6.0_01/bin/

and then run

jar cf charge.jar *.class

or else run it with the full path of java binary

/usr/local/java/jdk1.6.0_01/bin/jar cf charge.jar *.class

Upvotes: 1

thar45
thar45

Reputation: 3560

Use the complete path to the jar program, which is in Java's bin directory. Like

jdk_with_version\bin\jar cvf *.class

Upvotes: 0

Alex Coleman
Alex Coleman

Reputation: 7326

Use 'java -jar' Not just 'jar'

Upvotes: 0

Related Questions