Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Kiran H Iyer
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic