• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Package, compiler and JVM

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have simple package "com.testing" contains only one class (Employee.java).
Next I have program which import com.testing.*; (TryPkg.java).
Directory structure is as follow:
C:\Javastuff\com\testing\Employee.java
C:\Javastuff\TryPkg.java
I can compile *and* run this program :
C:\Javastuff>javac -classpath "C:\Javastuff" TryPkg.java
C:\Javastuff>java -classpath "C:\Javastuff" TryPkg
But WHY when i move TryPkg.java to C:\ it *compiled*, but not execute?
It seems there's a different classpath search for compiler and JVM?
C:\>java -classpath "C:\Javastuff" TryPkg
Exception in thread "main" java.lang.NoClassDefFoundError: TryPkg
TIA.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All
Welcome to the Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please re-register under an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
reply
    Bookmark Topic Watch Topic
  • New Topic