• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

importing Package

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have created a package by name "m" in a directory c:\myjava with the directory name m. I have created a file in c: directory which is importing the package m by name test.java. when i try to compile test.java...it's giving error can't find package m. I have set the path environmental variable to c:\myjava

how to compile this program?

Thanks.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set the CLASSPATH environment variable
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to Java In General (Beginner).
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As mentioned above, you need to set the CLASSPATH environment variable instead of PATH. The difference is that the operating system uses PATH to find programs it can execute from the command line. Including the Java installation directory in the PATH environment variable allows you to just type "java" and "javac" instead of the full path to these programs. On the other hand, Java itself uses the CLASSPATH variable to find classes. This means that the CLASSPATH should include the c:\myjava directory but PATH shouldn't.

I hope this helps. Please come back for futher clarifications if you need them.

Layne
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic