开发者

Can Relative path be provided for -classpath (java)

开发者 https://www.devze.com 2023-04-11 14:37 出处:网络
Can I do this: javac -classpath ././My_Jars/*;././My_Other_Jars/* -d bin Test.java Above command always throws ClassNotfound! (My_Jars not found and My_Other_jars not found)

Can I do this:

javac -classpath ././My_Jars/*;././My_Other_Jars/* -d bin Test.java

Above command always throws ClassNotfound! (My_Jars not found and My_Other_jars not found)

Java: JDK 6 开发者_StackOverflowOS: Windows 7


You should use .. (double dots) rather than . (single dot - which refers to current directory) for using relative paths.


The asterisks in a class path is not a wild card but instead tell loads the classes from jar files. If your classes are not in jars then you would just use <path>/.

But given your names, I do not think that is the issue. You may want to try:

javac -classpath ./../My_Jars/*;./../My_Other_Jars/* -d bin Test.java 

if your Jars are one level up from the current working directory.


I suspect that the problem is not the relative path, but the use of wildcards (the asterixs). These are actually expanded by the command line environment (the shell) - and in this case would not probably give what you are expecting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号