how to solve the following class not found exception
Hello friends,
I have a swing/applet class file, and i am trying to integrate it with Tomcat webapps
My HTMl code goes like this...........
<APPLET ALIGN="CENTER"
CODEBASE="/../../classes/org/jgraph/"
CODE="SimpleGraph.class"
WIDTH="800" HEIGHT="500">
</APPLET>
My classes are found inside the code base URL............
CODEBASE="/../../classes/org/jgraph/"
My folder structure is like below.....in which "SimpleGraph.class" is found
D:\June5WF\Archicentro\web\WEB-INF\classes\org\jgraph\SimpleGraph.class
My HTML resides in the following directory structure...
D:\June5WF\Archicentro\web\WEB-INF\jsp\secure\admin\ramesh.jsp
But When I run the JSP page .... I am Getting Class not found exception..........
Please can anyone tell me how to solve this problem....
I have spent 4 hrs in this......PLZ help me out.....
# 1
Four problems.
First, your CODEBASE attribute starts with a /, which means that the "../../" would point up, out of the docroot of the server. Some web servers won't allow that. You probably mean to start it with "../". But actually the whole classpath is wrong for other reasons, to follow...
Second, if the package of the class is org.jgraph.SimpleGraph, then the CODEBASE would actually be ...classes, and then the CODE would be "org.jgraph.SimpleGraph".
Third, unless you're actually a developer of the JGraph package, you should probably not put your in the org.jgraph package. Create your own package structure.
Fourth, the WEB-INF directory on most servers is not directly accessible to clients. It's treated as if it doesn't exist, for normal plain web requests (it's used specially for certain server-side functionality which is exposed in a different way). Applets need to grab class files as if they were plain static content. Generally speaking, you should probably keep your applet classes and your servlet classes wholly separate, since they're deployed in such different ways.
So you should probably create a directory like this:
D:\June5WF\Archicentro\web\classes
And put your classes in there. Suppose you put SimpleGraph in a package named "mypackage". Then SimpleGraph would go here:
D:\June5WF\Archicentro\web\classes\mypackage
And your CODEBASE attribute would be this: "/classes/"
And your CODE attribute would be this: "mypackage.SimpleGraph".