I've usually used an IDE for my Java programs but I've recently switched to the Command Line.
I created several classes that are in the same directory as my "main" program that I wish to compile. However, the command 'javac -cp test.jar ColorTester.java' yields:
ColorTester.java:24: cannot find symbol
symbol : class IntToColor
location: class ColorTester
IntToColor colorFunc = new ModThreeToColor(testColor,
^
My classes IntToColor and ModThreeToColor have both been compiled into class files, but it's still not making a difference.
The IDE had always taken care of this for me, so as you can imagine I'm quite confused.
Thank you.
Like this:
java -classpath <here> Program
Replacing <here>
with the list of classes and/or jars and/or packages that make up your classpath, separated by the :
character on Unix (or the ;
character in Windows). There's plenty of documentation online, for example read this link .
在命令行类路径中包括当前目录。
javac -cp test.jar:. ColorTester.java
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.