Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package

 
Mike Shn
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
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?

Thanks
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Regards,
Manfred.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic