This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to access a package that we have created from another java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to access a package that we have created from another java application " Watch "How to access a package that we have created from another java application " New topic
Author

How to access a package that we have created from another java application

Kiran H Iyer
Greenhorn

Joined: Dec 03, 2001
Posts: 11
I have created a package.Then i tried to acces a class inside that class by using import package.*;
But it is not accessible.But if we r giving it as pimport package.class it will work.
omar khan
Ranch Hand

Joined: Feb 01, 2001
Posts: 183
Originally posted by Kiran H Iyer:
I have created a package.Then i tried to acces a class inside that class by using import package.*;
But it is not accessible.But if we r giving it as pimport package.class it will work.

Have you set CLASSPATH correctly?
Jason Kilgrow
Ranch Hand

Joined: May 21, 2001
Posts: 47
Originally posted by Kiran H Iyer:
I have created a package.Then i tried to acces a class inside that class by using import package.*;
But it is not accessible.But if we r giving it as pimport package.class it will work.

In order to find a class in a package, the jar file (package) must be on the classpath and the class you are trying to access in the package must be declared public.
How to put the jar on the classpath depends on your OS. In Windows, you can
set CLASSPATH=%CLASSPATH%;c:\myjars\newjar.jar
The jvm walks the classpath until it finds the package that you are talking about. Remember, too, that a jar is-a directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access a package that we have created from another java application