File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes use jar file in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "use jar file in jsp" Watch "use jar file in jsp" New topic
Author

use jar file in jsp

Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
I want to use classes in a jar file, where can I put this jar??? under lib folder, or classes folder???

thanks in advance!!!
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
tomcat/common/lib
or
yourwebapp/WEB-INF/lib


Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
yes, this jar file is under web-inf/lib but I have a problem while referencing this jar file classes in jsp files. For example:
I have a jar named upload.jar
and in a jsp file I have the import:
<%@page import="com.base.util.Upload"%>
this class is packaged in upload.jar but I have a compiler error (could not find package)
what can I do???
Leandro Oliveira
Ranch Hand

Joined: Nov 07, 2002
Posts: 298
maybe I am using jar tool incorrectly....
I have my package 'com' in the following path: c:/com/classes...
I want to import com.pack.otherpack.* for example and I'm executing the following command line:
c: (enter)
jar -cvf upload.jar -C com/ .
is this correct???
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
It sounds as if your jar file may have a few too many levels of directory in it. A simple way to ckeck is to open the jar file using something like WinZip, and see what the paths are. If your class is com.ugh.stuff.Example.class you should see a row in the WinZip display saying
Example.class {some stuff about type, size, modified etc} ... com/ugh/stuff
Your jar probably has something more like com/classes/com/ugh/stuff which won't work.
Try "cd"ing to the classes sirectory, and building the jar there.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: use jar file in jsp