aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem importing user created classes" Watch "Problem importing user created classes" New topic
Author

Problem importing user created classes

J Chitra
Greenhorn

Joined: Sep 16, 2004
Posts: 18
Hi,
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\java1.java and
2.source_files\a\b\c2\java2.java

I declared java2.java(in 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 java1.java, 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.


SCJP(1.4)
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
Greenhorn

Joined: Sep 16, 2004
Posts: 18
Thanks Mike. I changed the classpath to class_files dir and its working fine now.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem importing user created classes