aspose file tools*
The moose likes Beginning Java and the fly likes classes in same folder, but not compiling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "classes in same folder, but not compiling" Watch "classes in same folder, but not compiling" New topic
Author

classes in same folder, but not compiling

Priyha Jootu
Ranch Hand

Joined: Sep 13, 2001
Posts: 47
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
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Priyha Jootu
Ranch Hand

Joined: Sep 13, 2001
Posts: 47
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: classes in same folder, but not compiling