Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

use jar file in jsp

 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 541
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tomcat/common/lib
or
yourwebapp/WEB-INF/lib
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic