| Author |
importing Package
|
putti don
Greenhorn
Joined: Jul 28, 2005
Posts: 20
|
|
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.
|
 |
Rupak Khurana
Ranch Hand
Joined: Mar 01, 2005
Posts: 89
|
|
|
set the CLASSPATH environment variable
|
SCJP 1.5<br />SCWCD 1.4
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
|
Moving to Java In General (Beginner).
|
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
|
 |
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
|
|
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
|
Java API Documentation
The Java Tutorial
|
 |
 |
|
|
subject: importing Package
|
|
|