This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes classpath Ques Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "classpath Ques" Watch "classpath Ques" New topic
Author

classpath Ques

pradeepta chopra
Ranch Hand

Joined: Jul 05, 2008
Posts: 137
given the following directory structure



current directory is bin
when i run the following command it gives an error

javac -cp test\myApp test\GetJar.java

Error:cannot access Foo.java
Bad class file test\myApp\Foo.java
file does not contain class Fooplease remove or make sure it appears in the current subdirectory of the classpath.



what does the above error mean??
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

modify your command as

javac -cp test test\GetJar.java

then try it...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
pradeepta chopra
Ranch Hand

Joined: Jul 05, 2008
Posts: 137
Now it says
cannot find symbol
symbol:class FOO

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

just archive the whole directory and upload it on rapidshare. Then provide a link so that I can solve your problem...
joseph gonzales
Greenhorn

Joined: Jun 21, 2008
Posts: 6
Hi pradeepta

try to import myApp.Foo; in the GetJar class because the Foo.java is located in different package and because of that GetJar class cannot able to find the Foo class. I've tried this and it works fine..




preparing SCJP
[ November 06, 2008: Message edited by: joseph gonzales ]
saiharsha peddinti
Greenhorn

Joined: Nov 06, 2008
Posts: 2
Hi Pradeepta,

Better import the Package in which we have the Foo.java or else give the complete path of Foo after Extends statement as


public class GetJar extends myapp.Foo

or
include import myapp;


the problem you are facing here is that the GetJar tries to extend Foo which GetJar supposes that it will be in the same package but there is no Foo avaialble in test; instead it is present in sub package myapp.
 
wood burning stoves
 
subject: classpath Ques
 
Similar Threads
K&B doubt regarding question in Development chapter
Question related to self test question in SCJP (Sierra/Bates) Java 6 book
ch10 q11
Mistake in GuideBook for SCJP Java 6.0, Chapter 10, Self Test question 11
Doubt at K&b chapter 10,question 11