File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes How to set classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to set classpath" Watch "How to set classpath" New topic

How to set classpath

deepan thiagu

Joined: May 15, 2007
Posts: 18
package p1;
public class Super
public void print()
import p1.*;
class Sub
public static void main(String a[])
new Super().print();

i compile the the file and create the package p1. then i compile the file in same location it gives an error message like

E:\JSF>javac cannot access Super
bad class file: .\
file does not contain class Super
Please remove or make sure it appears in the correct subdirectory of the classpa
new Super().print();
1 error

who can i solve this problem
Leandro Melo
Ranch Hand

Joined: Mar 27, 2004
Posts: 401

Did you put the compiled file Super.class inside the p1 directory?

Leandro Melo
SCJP 1.4, SCWCD 1.4
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
See if THIS helps. At step 3 it introduces a directory structure that matches the package structure. That's the most natural way to set things up.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: How to set classpath
It's not a secret anymore!