• 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

Problem importing user created classes

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
J Chitra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mike. I changed the classpath to class_files dir and its working fine now.
 
reply
    Bookmark Topic Watch Topic
  • New Topic