• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

where to keep .jar file that is called in jsp page

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am importing a package in my jsp page. All imported packages are in a jar file. Where should I place this jar file inorder to view by my jsp page.
Thanks for your valuable time
Gopi
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

In the properties file of the JSP server u can mention the classpath for the jar files which u will be using. You can type the location of u r jar file in the classpath.
Mahesh

Originally posted by Gopi Krishna:
Hi,
I am importing a package in my jsp page. All imported packages are in a jar file. Where should I place this jar file inorder to view by my jsp page.
Thanks for your valuable time
Gopi


 
Gopi Krishna
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am a bit hasty in posting my question.
Here are details. I am using Weblogic 5.1.
and in my "myjsp.jsp" page I refer to classes of package
<%@ import page="com.xyz.abc" %>
and all classes of com.xyz.abc package are in a jar file ABCD.jar file.
Where should I place this ABCD.jar file so that myjsp.jsp page can see them.
Thanks Mahesh.
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gopi,
Basically we have to create the .class file, create a .jar file which includes this .class file , add this .jar file in classpath, import the .class file in jsp and use it!
Here are the steps.
1. Compile the .java file into .class file in any dir you like
For example : javac JavaRanch.java

2. Create a ABCD.jar file like this in the same dir like foll

This will create a ABCD.jar file in same dir where you executed the command at dos prompt. The servlet API says ...\webapps\webApplnName\WEB-INF\lib dir is the place where all .jar files should go. So I just moved the ABCD.jar to this dir (..\webapps\webapplName\WEB-INF\lib)
3. Now include this ABCD.jar ( "c:\jakarta-tomcat\webapps\MISAPP\WEB-INF\lib\ABCD.jar" )file in your classpath either by editing c:\autoexec.bat file or some other means.
4. To get the new classpath get into effect just execute c:\autoexec.bat at the command prompt once. Now at command prompt just execute c:\set [ENTER] to see if this ABCD.jar is in classpath setting to make sure.
5. To invoke the class in jsp do this. My sample welcome.jsp file is

6. Save this welcome.jsp as ...\webapps\webApplnName\welcome.jsp
7. stop and restart the server (tomcat may be)
8. Invoke the jsp from browser like this http://localhost:8080/WebApplnName/welcome.jsp
I tested this and able to invoke the JavaRanch.welcome() method which is in ABCD.jar file from welcome.jsp file and got the String "Hello Everyone!" displayed in browser. Give it a try!
(careful in typing the webApplnName in http://localhost:8080/webApplnName/welcome.jsp at the browser because it is case sensitive and your appln Name may be different. If so give your appln name instead.)
regds
maha anna

[This message has been edited by maha anna (edited January 25, 2001).]
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used Weblogic for last project, somehow its jsp compiler can not find jar file even though you put it on the classpath. In the weblogic.properties file, here is the line I did:
weblogic.httpd.servlet.classpath=E:/weblogic/myserver/servletclasses;\
E:/weblogic/myserver/servletclasses/jaxp.jar;\
E:/weblogic/myserver/servletclasses/parser.jar;\
E:/weblogic/myserver/servletclasses/xml.jar;\
E:/weblogic/myserver/servletclasses/mail.jar;\
E:/weblogic/myserver/servletclasses/providerutil.jar
weblogic.httpd.servlet.reloadCheckSecs=1
However, that does not work for jsp. I searched for a while, and no one seems to have the answer, so finally what I did was unjar the file into E:/weblogic/myserver/servletclasses.
Have you ever thinking about doing a WAR instead of jar.
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic