Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

packages

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happened when you compiled the file - were any directories created?
 
Sree kanth
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic