• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

jar files

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a jar files which i store in web-inf/lib in my web application folder. if i want to call a class in the jar files from my servlet, how am i going to do that?
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You just import the class into your code and instantiate the objects as usual.
 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i try to do that but i still got error which says the package does not exist. and one more question is can u tell me about this error

.....cannot resolve symbol
 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Suka Hati,
That error is raised by compiler when it doesn't find proper class which you use because you dont give the proper classpath of the library.

May I know what class you used?

As you said that you build a web application, i think it is the best way to check again the directory structure of your web application.
All the extended library, you use, is placed on <web-app>\WEB-INF\lib

Hope this help
Correct me if I am wrong
thanks
daniel
 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi...

i do put my .jar files in folder tomcat/webapps/speech/WEB-INF/lib/**.jar

i just need to import it as usual...(like below)

import ***.*;

and call the class that i need in those .jar files....(like below)

Try try=new Try();

is it true, or there's other way to do it?
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Suka Hati,
I think you are right about that.
And you can use class on that library and it should run well...
Let me know what's error you have when you run that application...

thanks
daniel
 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the error that i got is:

package *** does not exist

should i add the path of the package in the CLASSPATH....actually i have done it but there's no different
 
reply
    Bookmark Topic Watch Topic
  • New Topic