This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package" Watch "package" New topic


Mike Shn
Ranch Hand

Joined: May 26, 2001
Posts: 149
I wrote a porgram at the beginning of a class I have
package mypackage:
Bit it gives me an error incorrect path.
Why is that?

Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Mike,
When you place a package statement inside a *.java file the file must be placed into a subdirectory of that same name when you want to run it. Then when you run it you should type:
java mypackage.className
Don't get me started about those stupid light bulbs.
subject: package