Link to home
Start Free TrialLog in
Avatar of TristanTheHakSoar
TristanTheHakSoar

asked on

how to enable external jar files for java classes on a web server

Hey experts,

I am trying to use this itext-2.1.5.jar file to read a txt file on our server and produce a pdf file for printing.

This class works fine and compiles in eclipse which has this file included in its libraries but when uploaded on the server it says it cannot find the itext.jar file i'm guessing since it is in the wrong location and/or probably not referenced properly in my class as well.

Here is java console error:

java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException
Caused by: java.io.IOException: open HTTP connection failed:http://mycompany.ca/data/DIR1/DIR2/Mobile/com/lowagie/text/DocumentException.class

mobile is the location of the java class and .txt file

I tried placing it in the same directory as the applet and txt file with no success and also found a lib directory where access was denied. If it helps i have found out that this is an Apache server but the staff at technical support don't really know how to go about this either.

Any ideas how this should be done? I am using eclipse to create the java class files and i noticed it also creates a policy file, should i be including this on the server as well perhaps?

Thanks,
-TristanTheHakSoar
Avatar of mrcoffee365
mrcoffee365
Flag of United States of America image

Is this an applet or code which runs in the Web server?

If it's in the Web server, then the .jar file has to be here:

<tomcat webapp>/WEB-INF/lib/itext-2.1.5.jar

If you don't have permissions to put things there, then you have to get someone to do it for you.
Avatar of TristanTheHakSoar
TristanTheHakSoar

ASKER

Hey mrcoffee,

So yeh this is an applet called by a Perl file using CGI script and printing out HTML which says:

print "<p align=\"center\">";
      print "<applet code=\"dailyPDF.class\" codebase = \"ourwebsite.ca/data/$id/$stat/Mobile\" width=\"860\" height=\"300\" name=\"dailyPDF\">";
    print "</applet>";
    print "</p>";

So i've been through all the directories available on FileZilla but the only one i can find that is a match is CGI-BIN which contains all our CGI scripts and Perl files and a directory called Plugins that contains the Java classes we ourselves write.

That's probably useless information but as for the permissions side of things i could always phone back the customer support guys but i don't want to do that until i know where this file needs to go.

Is there a typical spot for these files or somekind of a reference that could show me the average tree structure of an Apache server file system? I can't seem to find anything like that, not even on our host's website, fatbanana.ca, but another source suggests that maybe i need to do something about the class path?

thanks!

-TristanTheHakSoar
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, if it's an applet, then you need to identify the jar as "objects" mentioned above.  I like this documentation better:
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jarGuide.html

That page mentions that the jar has to be relative to the page which invokes the applet.  So if your directory on the server for the page which has the applet HTML is in
ourwebsite.ca/data/$id/$stat/Mobile
then that would be a good place to put all the jars your applet needs.