Hi,

I'm not sure if this is going to help, but... from the jdk javadoc:

the package of the class, or null if no package information is available
from the archive or codebase.

It doesn't really clarify when no package information would be
available... but in the Package docs:

Package objects contain version information about the implementation and
specification of a Java package. This versioning information is retrieved
and made available by the classloader that loaded the
class(es). Typically, it is stored in the manifest that is distributed
with the classes.

I guess your a jar has no manifest .. so because there's no manifest,
there's no package information.  From what I can see (and I haven't
looked far, so dont rely on this too much) the getPackage doesn't map to a
package as in com.MyClass  belonging to the com package... 

anyway, I hope that helps a little... I think you might be able to find
more in the javadocs, there looks like there's a fair bit around Package
and Class that might be helpful.

otoh someone who has used this functionality might have a better answer
(o:

cheesr
dim

On Mon, 24 Sep 2001, Eung-ju Park wrote:

> Hi.
> 
> I have one jars file in /WEB-INF/lib/test.jar
> test.jar contains com.MyClass class.
> 
> I try below code in test.jsp.
> 
> <%page import="com.*" %>
> ...
> <%
> if ( null == MyClass.class.getPackage() ) {
>     out.println( "NULL" );
> } else {
>     out.println( MyClass.class.getPackage() );
> }
> 
> But classes in /WEB-INF/classes's getPackage() is not null. Why?
> 
> I try with resin. resin 2.0.2 occure same problem.
> It's servlet spec?
> 
> PS. sorry for ugly English. ;-)
> 
> 

Reply via email to