• 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

package urgent!

 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have problem compiling the following files
package A;
public interface B{}
//first file

package A;
public class C implements B{}
//second file
The second file is not compilable because javac could not find "B".
Also
package A;
public class D {}
//first file
package A;
public class E extends D{}
//second file
Also second file not compilable because javac could not find "D".
Why a class could not access public interface or public class in the same package?
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cameron,
Assuming that you are in C:\Cameron directory, try these steps :

    [list]

    [/list]
  1. Compile the code using javac -d . B.java
  2. Verify that you have a directory C:\Cameron\A created which has B.class file in it.
  3. Verify that you are now in C:\Cameron directory.
  4. [list]

    [/list]
  5. Compile the code using javac -classpath . -d . C.java
  6. Verify that you have C.class created in C:\Cameron\A directory.

  7. You may try this with the other piece of code snipplet you pasted.Also, you may try changing the package for C class and see if that compiles.
    Let me know if you still face problems.
    -- Sandeep
    SCJP2, OCSD(Oracle JDeveloper), OCED(Oracle Internet Platform)
    [This message has been edited by Desai Sandeep (edited July 24, 2001).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic