Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 818
  • Last Modified:

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?

  • 2
1 Solution
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.
TristanTheHakSoarAuthor Commented:
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?


you need to specify the jar in the archive param of the applet tag

Yes, if it's an applet, then you need to identify the jar as "objects" mentioned above.  I like this documentation better:

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
then that would be a good place to put all the jars your applet needs.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now