Two Laptop Bag
The moose likes Servlets and the fly likes import jar file in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "import jar file in servlet" Watch "import jar file in servlet" New topic

import jar file in servlet

Suka Hati
Ranch Hand

Joined: Oct 28, 2004
Posts: 56
Hi there,
I have a question.
In a servlet if we want to call a jar file we should import it.
Eg. import test.*;

if we want to use a class in that jar file, the way we call it is :

Try try = new Try();

and calling method in that class:


What if we want to initialize it. How to do this?Is the below code right?

Try try = new Try(1,2);
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Try try = new Try(1,2);

It would be correct if the Try class defines a constructor with 2 int (or..) parameters. Are you facing any problems?

Consider Paul's rocket mass heater.
subject: import jar file in servlet
It's not a secret anymore!