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 Problem importing user created classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem importing user created classes" Watch "Problem importing user created classes" New topic

Problem importing user created classes

J Chitra

Joined: Sep 16, 2004
Posts: 18
I have a probem with importing. The directory structure is like this:

I have a java_files as the base directory. and under that I have 2 dir.s: class_files & source_files.

Now,what am trying is :
i have 2 .java files in the source_files directory:
1.source_files\a\b\c1\ and

I declared which all the class,method names are public) in a package called a.b.c2 and wrote the .class file to the class_files directory using -d while compiling.

when i tried to import a.b.c2.*; in my, i get a compiler error saying that package a.b.c2 does not exist.

Where is the problem? I checked the the existence of the .class file in class_files\a\b\c2. It IS there.

Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
Please display your entire CLASSPATH and post it here.

In the example you gave, c:\...\java_files\class_files should be in your CLASSPATH.
[ October 30, 2004: Message edited by: Mike Gershman ]

Mike Gershman
SCJP 1.4, SCWCD in process
J Chitra

Joined: Sep 16, 2004
Posts: 18
Thanks Mike. I changed the classpath to class_files dir and its working fine now.
I agree. Here's the link:
subject: Problem importing user created classes
It's not a secret anymore!