I wrote a Java program that has 3 classes. When, I use javac, I am getting errors whenever my main class attempts to interact with the other classes. Is there anything special that I need to do? I am just calling javac Main.java. Any help would be greatly appreciated.
Edit:
DFA myDFA = new DFA();
String test = args[0];
if(myDFA.accept(test))
and the error is:
Main.java:19: cannot find symbol
symbol: class DFA
location class dfa.Main
I have 3 of those errors
Yes, you need to specify the
classpathusing the-classpathoption onjavacwhen you compile.Try compiling like this:
Note the ‘dot’ after
-classpath. It tells the compiler to look in the current directory to find any .java files that it needs.If you need other paths or JARs, you have to make sure that they appear in the
-classpathas well.