Hi all, This is a very basic question, but not sure why this compile error.I have 2 java files named hello1.java and hello2.java in same directory named c:\epal_sts\code\ I am calling the method of hello2 class from hello1. But when i compile hello1.java, it says this error: C:\EPAL_STS\code>javac hello1.java hello1.java:8: cannot resolve symbol symbol : class hello2 location: class hello1 hello2 h2 = new hello2(); ^ hello1.java:8: cannot resolve symbol symbol : class hello2 location: class hello1 hello2 h2 = new hello2(); ^ 2 errors The 2 files are:
Is there anything wrong here? Please let me know why the compile error comes. Thanks priyha
You've probably got an explicit setting for the CLASSPATH variable that doesn't include an entry for "." (dot,) the current directory. If you don't specifically need to set the CLASSPATH (and as a beginner, you don't) then don't; the default setting would work fine here. CLASSPATH is an environment variable -- the proper way to set it or check it is system-dependent.
When i was working with some other java code, i had to creat a new variable classpath in the environment variable settings. But i didn't include the . (same directory) in it. Now i added the . in the classpath and the program hello1.java compiles fine. Thanks a lot priyha