Dear
Java Community
If you find my directory structure confusing from the paras below please refer to Dig. below:-
-----------------------------------------------------------------Part-I
-----------------------------------------------------------------I am using Windows 98 & facing problem with Packages or better to say at the time of compilation.,
I have three programs (1) Line.java (2) Point.java and the main() one (3)TryPackage.java stored as follow
C:\MYWORK\Packages\Geometry> contains Line.java & Point.java
C:\MYWORK\Packages\TryPackage> contains TryPackage.java
now when i compile TryPack like this:-
C:\MYWORK\Packages\TryPackage>javac -classpath "C:\MYWORK\Packages" TryPackage.java
it compiles fine but when i try to run the program like this
C:\MYWORK\Packages\TryPackage>java -classpath "C:\MYWORK\Packages" TryPackage
the following error ocurs
Exception in
thread "main" java.lang.NoClassDefFoundError: TryPackage
Now how i over come the problem is that cut both my *.java & *.class file from the TryPackage folder delete the folder and paste both the files in the packages folder along with Geometry folder....compile them & run the application again it runs fine.
-----------------------------------------------------------------Part-II
-----------------------------------------------------------------Why do we need to compile our program when workin with package using the classpath stuff, i mean when i tried to compile TryPackage.java like
C:\MYWORK\Packages>javac TryPackage.java
and run it like
C:\MYWORK\Packages>java TryPackage
it works fine then also....so whats the purpose
Please if possible, refer me some easy to understand tutorial or just HELP ME OUT!
Regards
Azam Bukhari
[email protected] -----------------------------------------------------------------Diagramatic View
-----------------------------------------------------------------
finally my directory structure looks like this @ the time of error free execution:-
[This message has been edited by Cindy Glass (edited December 03, 2001).]