Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Class not found?

 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Animal.java
Dog.java
Beagle.java
All three files are not compiled.

Here is the SampleAnimal.java:


When I compile SampleAnimal.java, Compiler says it can't find Animal, Dog and Beagle...

Why doesn't compiler compile all three source files too with SampleAnimal.java?





PLEASE Help!


Regards,
cmbhatt
 
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chandra,

All four programs are under collections folder.
You want SampleAnimal.java complied to scjp packge.

ok. javac program will not check for required files in current path until unless you specify.

Define classpath and include the current direcory(.):
set classpath = %classpth%;.;

Now try your case again.
Hope it works.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nay Srini,

It is not working yet!!!

Actually I was working to test whether the other required source files are
compiled or not. In another case it is working. See





Now SampleAnimal.java compiles fine, and all three required files are too.
But if all the files are in the same directory, SampleAnimal.java does not
compile.

???
Help!


Regards,
cmbhatt
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then it should work without
package scjp; statement. in first post.

we are unable to import default packge into scjp package.
we are not able to represent default package with a "package name".

Hence the problem came.
[ April 20, 2007: Message edited by: Srinivasan thoyyeti ]
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nay Srini,

It is not working yet!!!

Actually I was working to test whether the other required source files are
compiled or not. In another case it is working. See





Now SampleAnimal.java compiles fine, and all three required files are too.
But if all the files are in the same directory, SampleAnimal.java does not
compile.

???
Help!


Regards,
cmbhatt
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Animal,Dog,Beagle NOT FOUND


Animal,Dog,Beagle NOT FOUND

WHY isn't it working???

My intention with using -d ".", is SampleAnimal.class file should go to the scjp folder, not stay on the collections folder; in the source file SampleAnimal.java, package scjp is given.




Regards,
cmbhatt
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Srini Says,
we are unable to import default packge into scjp package.



But I have written "package scjp" in all the three source files Animal.java,
Dog.java and Beagle.java.




Regards,
cmbhatt
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then complile them first
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chandra,

I have executed a scenario >worked out

1.Move required .java files(Animal,Dog,Beagle) to packge scjp.
c:\collections\scjp>

2.now compile SampleAnimal.java
c:\collections> javac -d . SampleAnimal.java
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


1.Move required .java files(Animal,Dog,Beagle) to package scjp.



Yeah!!! It is working.
But "Ye baat kucch hajam nahi hui"
"Hard to digest"




Thanks Srini


cmbhatt
 
reply
    Bookmark Topic Watch Topic
  • New Topic