Code Comments
Programming Forum and web based access to our favorite programming groups.Frances Del Rio wrote:
> Juha, just as an experiment I packaged a simple helper class I have in
> an app.. class is sH.class (simple class that I use just to store vars
> to generate HTML code..) I put this class in WEB-INF\lib\com, then
> converted this 'com' into a jar.. ('jar cf sH.jar com' in WEB-INF\lib)
> so now I have WEB-INF\lib\sH.jar (sH.jar = com\sH.class..) and if in
> WEB-INF\lib I do 'jar tf sH.jar' I get
>
> META-INF/
> META-INF/MANIFEST.MF
> com/
> com/sH.class
>
> so far so good, right?
>
> so in servlet (which is in WEB-INF\classes\hm) I now do
>
> import com.sH; but when compiling servlet get told that
> 'package com.sH' does not exist..
>
> I must be missing something here..
> (again, Tomcat knows to look for packages in WEB-INF\lib, right? Juha,
> thanks again.. Frances
ok, I think mistake I made is I gave package same name as class inside
'com' dir.. what I did now: in WEB-INF\lib I have com\sH.class, so:
to create jar file: "jar cf html.jar com", which, when I do
"jar tf html.jar" returns:
META-INF/
META-INF/MANIFEST.MF
com/
com/sH.class
in servlet (in WEB-INF\classes\hm) I do
import com.sH;
yet when I compile I get told 'package com doesn't exist'..
now I REALLY don't know what I am doing wrong.. would appreciate
leads... thank you... Frances
Post Follow-up to this messageare u trying to compile the servlet or run/access thru browser the servlet? If you are just trying to compile - I think maybe the issue is not in the package structure. it's in the compiling tool you're using. How are you compiling your code? Make sure that the jar is in your classpath or if you're using one of the standard IDE's. that you have it listed, with the correct path, as one of the required libraries.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.