So I've been trying to solve this problem for a matter of hours now. I've scoured the internet, I've scoured StackOverflow, I've asked some co-workers (I'm an intern) and honestly no one can tell me what is going on! I put together a really really simple example to show you what I'm doing (and I get the error even with the simple example)
I have two .java
files. One is Test.java
the other is testClass.java
.
//testClass.java
package test;
public class testClass {
private int someMember=0;
public testClass(){
//kill me now
}
}
Then I have my Test.java file which contains my main method. (although in my real problemIi dont have a main method - its a servlet with a doGet()
method)
//Test.java
package test;
public class Test {
public static void main(String[] args) {
testClass myTest = new testClass();
}
}
I'm compiling with the following (from windows command line, with current directory where I saved my .java files):
..java bin location..javac testClass.java
This works absolutely fine and I get a testClass.class file in the current directory. I, then, try to compile the Test.java file with the following (again within the working directory):
..java bin location..javac -classpath . Test.java
This results in the following error:
Test.java:6: cannot find symbol
symbol : class testClass
location : class test.testClass
testClass myTest = new testClass();
Can you please help a brother out? :(
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…