This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Simple Package Problem..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Simple Package Problem....." Watch "Simple Package Problem....." New topic
Author

Simple Package Problem.....

Steve Jensen
Ranch Hand

Joined: Sep 23, 2002
Posts: 126
Folks, my wotking directory is C:\java

All my programs are held in sub-directories inside this folder.

For ther code listed below, I created a folder called MyPack, ie

c:\java\MyPack

The code below:-


Gives me the following error when I compile it:-

AccountBalance.java": Package C:\Java\MyPack\AccountBalance.java stated in source MyPack does not match directory C:\Java\MyPack\AccountBalance.java. at line 2, column 9

Can anybody explain why?

AccountBalance.java is in the directory structire c:\java\MyPack

Any help is appreciated. Thanks in advance


John Bonham was stronger, but Keith Moon was faster.
Paul Santa Maria
Ranch Hand

Joined: Feb 24, 2004
Posts: 236
Uh - did you try saying "public class AccountBalance"?

There might be other problems, but that's the first thing I'd try...

'Hope that helps .. PSM


Paul M. Santa Maria, SCJP
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

You should compile this from the directory C:\Java:

C:\> cd Java
C:\Java> javac MyPack\AccountBalance.java


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Simple Package Problem.....
 
Similar Threads
how to compile packages
package problem
package importing problem
Why am I not able to this code in eclipse?
JBuilder 2005 - simple PACKAGE problem - please help me - anybody!!