I'm trying to compile my class files. I have two classes. when I compile them i get the following error: c:\java\test\src>javac MyTest.java MyTest.java:6: cannot resolve symbol symbol : variable Test location : class MyTest String t = Test.gethelp(); ^ 1 error Here is my code: public class Test { public String gethelp() { String test = "time"; return test; } } public class MyTest { public static void main(String[] args) { String t = Test.gethelp(); System.out.println("THe word is " + t); } }
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
posted
0
That's odd. The javac compiler should look for such class dependencies automatically. Since it isn't, you should simply compile Test.java first, then compile MyTest.java. You can even do this all with one command: javac Test.java MyTest.java HTH Layne