• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

classes in same folder, but not compiling

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Priyha Jootu
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic