File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "packages " Watch "packages " New topic


Maha Hassan
Ranch Hand

Joined: Aug 02, 2005
Posts: 133
Dear All,

I am trying to run a file from a package but it does not run. I get the error of NoClassDefFound.
I compile the file with

But when I run it with

I get the error ..

What am I missing ??


Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15037

Add -cp ".;..;%CLASSPATH%" also when you run the program:

java -cp ".;..;%CLASSPATH%" Package.fileName

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Maha Hassan
Ranch Hand

Joined: Aug 02, 2005
Posts: 133
I tried
java -cp ".;..;%CLASSPATH%" Package.fileName

And it is working perfectly )
[ September 13, 2007: Message edited by: Maha Hassan ]
I agree. Here's the link:
subject: packages
It's not a secret anymore!