This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple Package Problem.....

 
Steve Jensen
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Santa Maria
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15436
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should compile this from the directory C:\Java:

C:\> cd Java
C:\Java> javac MyPack\AccountBalance.java
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic