Ashish Sharma
Ashish Sharma

Reputation: 865

including folder into jar files

If we have a following structure

root(folder) -> -> jarss(folder) -> com(package) -> MyClass.class

and MyJar.jar(includes jarss/com.MyClass.class) located inside root(folder)

How to give path of com.myclass ?

eg. javac -cp root/MyJar.jar AnOtherClass.java

(this is not working because there is jars folder inside the MyJar.jar file first then MyClass.class)

Upvotes: 0

Views: 128

Answers (1)

dinesh028
dinesh028

Reputation: 2187

Why do you want to put *.Java file in Jar? One more thing that Java doesnot support jar in jar funda.

If you want to do this, suppose you have a Jar file in which org.test.test1.Myclass.java. that means jar file have a folder org , in which there will be a folder test and then test1 folder, test1 folder will have your class MyClass.java.

Just set the path of Jar file in your CLASSPATH like,

set CLASSPATH=./lib/MyJAR.jar

Then run it as,

javac -classpath %CLASSPATH% org.test.test1.Myclass.java

(Also look for the syntax and attributes of javac.)

I hope that this may give you some hint for the problem you are having.

Upvotes: 2

Related Questions