简体   繁体   中英

Setting up java classpath to use jars in a different directory

I'm having a really basic problem. I think I may be doing something stupid and would appreciate another set of eyes. I'm running Ubuntu 16.04.3

So I'm using ASMifier in order to convert my java class to asm byte code. If the asm-6.0 and asm-util-6.0 jars are in the same folder as my java class and I run the following command "java -classpath "asm-6.0.jar:asm-util-6.0.jar:." org.objectweb.asm.util.ASMifier {class name}" it works perfectly.

However when I try to using absolute paths so that I may have my class in a different folder and run the following command "java -classpath "~/asm-6.0/lib/asm-6.0.jar:~/asm-6.0/lib/asm-util-6.0.jar:." org.objectweb.asm.util.ASMifier {class name}" I get the following error "Error: Could not find or load main class org.objectweb.asm.util.ASMifier"

The pathing is correct so I'm not sure what the problem is.

I would appreciate any feedback

One way to include this jar file to your classpath is to put it in jre folder -> lib-> ext

Another way is to add this: -Djava.ext.dirs=c:....(location of your jar) before start jvm

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