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 packages 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 "packages" Watch "packages" New topic
Author

packages

Sree kanth
Ranch Hand

Joined: Feb 02, 2005
Posts: 53
Hi all,

I have created a new package.
now... do i need to create a new folder where i hve put the class file, or will it be automatically generated when i compile the file?


Rgds
Sree


Sree
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
What happened when you compiled the file - were any directories created?


Ping & DNS - my free Android networking tools app
Sree kanth
Ranch Hand

Joined: Feb 02, 2005
Posts: 53
Hi,
This is the error which i am getting while compiling a file which imports the package and uses the class "Factorial"
----------------
TestFactorial.java:6: cannot access Factorial
bad class file: D:\Shyam\fact\Factorial.class
class file contains wrong class: fact.Factorial
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
Factorial facObj=new Factorial();

-----------------
I have set the classpath as follows
set classpath=%classpath%;d:\Shyam;.
where my package "fact" lies in D:\Shyam.

What might be the problem

Rgds
Sree
^
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
Does the Factorial class actually have a statement "package fact;"? Or do you have another class Factorial somewhere? It sounds as if the hierarchy is somehow not correct.
 
 
subject: packages