> I have a simple applet that uses the (Jakarta http client .jar files)
> to get a status of a webpage.
I suspect your applet code may need to be jar'd and signed to access
URL's at different sites, but that is obviously not the source of the
current problems.
> java.lang.NoClassDefFoundError:
> org/apache/commons/httpclient/HttpException
OK, it is not finding the Jakarta classes, ..
> Any ideas how to get my applet to work in a browser??
>
> Below are my 2 files:
>
> StatusCodeApplet.java:
This code is in the 'default' package, which is not recommended,
but also not the cause of the current problem.
> import java.lang.*;
> import java.io.*;
....
> public class StatusCodeApplet extends JApplet
Why a JApplet? (as opposed to a java.applet.Applet)
...
> <html>
....
> <script type="text/javascript">
> function getStatusCode(uri)
> {
> return document.applets['statusApplet'].getStatusCode(uri);
>
> }
Applets take some time to load and start. You will probably
have better luck if you put a timeout/delay before checking
for the applet (whether your JS code is before or after the applet)
...
> <applet name="statusApplet" code="StatusCodeApplet.class" width="500"
> height="500" archive="commons-httpclient-3.0.jar"></applet>
This applet element, combined with this URL..
> The way I access the applet is:
> http://localhost/php/client/applet/Tst/StatusCodeApplet.html
Suggests to me that 'StatusCodeApplet.class' exists at..
http://localhost/php/client/applet/Tst/StatusCodeApplet.class
If that that is the case, the JVM is looking for the
'commons-httpclient-3.0.jar' at..
http://localhost/php/client/applet/Tst/commons-httpclient-3.0.jar
..is the jar in that location?
Andrew T.
trpost@gmail.com - 20 Apr 2006 21:31 GMT
yes all the files are in the same directory accessable through:
http://localhost/php/client/applet/Tst/...
andrewthommo@gmail.com - 26 Apr 2006 00:50 GMT
>> If that that is the case, the JVM is looking for the
>> 'commons-httpclient-3.0.jar' at..
>> http://localhost/php/client/applet/Tst/commons-httpclient-3.0.jar
>> ..is the jar in that location
> yes all the files are in the same directory accessable through:
> http://localhost/php/client/applet/Tst/...
OK.. (it helps to quote a little of earlier thread, like I did)
I'm stumped for the moment. Are you *sure* that
'commons-httpclient-3.0.jar' contains the
org.apache.commons.httpclient.HttpException class?
Check it using the jar command or a Zip tool.
Can you make all your files accessible form the internet,
so that we can look at them? It is a lot easier to debug
an applet directly (I could have checked both the file
locations and the Jar file by now).
Andrew T.