| Author |
Error in Package
|
deepak carter
Ranch Hand
Joined: Feb 19, 2011
Posts: 159
|
|
Hi,
I have following directory structure
F:\java1\new1\Test.java
The code for Test.java is
the second directory structure is
F:\java2\new2\Test2.java
which has the following code
I am compiling the Test.java in the following way
F:\>javac java1\new1\Test.java
and its compiling fine
when i am trying to compile Test2.java which is in java2\new2 package
F:\java2>set classpath.;= f:\java1\new1\Test.java
F:\java2>javac new2\Test2.java
Its showing error message
import java1.new1.*;
^
Test2.java:8: error: cannot find symbol
Test test=new Test();
^
symbol: class Test
location: class Test2
Test2.java:8: error: cannot find symbol
Test test=new Test();
^
symbol: class Test
location: class Test2
3 errors
|
 |
James Boswell
Ranch Hand
Joined: Nov 09, 2011
Posts: 657
|
|
The compiler cannot find Test.class which was generated when you successfully compiled Test.java.
Ensure Test.class is on your class path when you compile Test2.java
|
 |
deepak carter
Ranch Hand
Joined: Feb 19, 2011
Posts: 159
|
|
|
how to do that sir...i am trying since morning
|
 |
Tina Smith
Ranch Hand
Joined: Jul 21, 2011
Posts: 154
|
|
Put Test.class on your classpath...not Test.java. Or just put the whole new1 directory on the classpath.
It's also a good idea to specify the classpath right in the javac command rather than setting the environment variable.
|
Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
|
 |
deepak carter
Ranch Hand
Joined: Feb 19, 2011
Posts: 159
|
|
javac -cp .;C:\Tomcat 6.0\webapps\Beer-v1\WEB-INF\classes PropertyExample.java
I am using above path to compile but showing the error
C:\>javac -cp .;"c:\Tomcat 6.0\webapps\jsp\WEB-INF\classes" PropertyExample.java
javac: file not found: PropertyExample.java
Usage: javac <options> <source files>
use -help for a list of possible options
|
 |
deepak carter
Ranch Hand
Joined: Feb 19, 2011
Posts: 159
|
|
Can anybody reply in this...???
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
PatienceIsAVirtue.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Error in Package
|
|
|