• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

classpath Ques

 
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
modify your command as

javac -cp test test\GetJar.java

then try it...
 
pradeepta chopra
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now it says
cannot find symbol
symbol:class FOO

 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just archive the whole directory and upload it on rapidshare. Then provide a link so that I can solve your problem...
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic