简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM