Reputation: 2335
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.
Upvotes: 2
Views: 127
Reputation: 236004
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.
Upvotes: 5
Reputation: 38300
include the current directory in the command line class path.
javac -cp test.jar:. ColorTester.java
Upvotes: 1