• 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

how to import package

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
package superDir;
//if want to access the sub, need to import subDir.*; ok here,
public class superA{ }

///////////////////
//another package in the sub-directory of the above source code's directory
package subDir;
//how to import the superDir package if want to use the superA here???
public class sub{
private superA sa = new superA();
}//

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand you correctly, just use:
import superDir.* ;
Note that you still have to make sure that the compiler can find the superDir classes. There is documentation in a file called:
findingclasses.html in the docs/tooldocs subdirectory of the directory you installed the JDK files in.
Bill
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I agree with William. The corresct syntax for your problem should be:
import superDir.*;

You need to have a look at your classpath too, i think.
 
Michael Lin
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks you all,
I need to set the path as follow to make it work:
set classpath=c:\;c:\temp\;
reply
    Bookmark Topic Watch Topic
  • New Topic