File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
jQuery in Action, 2nd edition
 
subject: How to access a package that we have created from another java application
 
Similar Threads
Default Package
CLASSPATH PROBLEM
Why is this error?
what is wrong in this program involving thread
Package Inheritance