J Carpenter

Greenhorn
+ Follow
since Aug 09, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by J Carpenter

Paul and Andrew - thanks for the help! I put the same stuff on another site that does not have the ads that godaddy puts on free sites, and it worked fine. I guess when the client makes the request for the jar file, godaddy attaches the ad to the jar file when it sends it (or something along those lines.)

Thanks again!
12 years ago
Posting the error message, if anyone is interested...

load: class SignedAppletDemo.class not found.
java.lang.ClassNotFoundException: SignedAppletDemo.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: SignedAppletDemo.class
12 years ago
I changed the html to this ---

<html>
<head>
</head>
<body>
<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="200" height="200">
<PARAM name="code" value="SignedAppletDemo.class">
<PARAM name="archive" value="SignedAppletDemo.jar">
<comment>
<embed code="SignedAppletDemo.class"
archive="SignedAppletDemo.jar"
width="200"
height="200"
scriptable="true"
mayscript="false"
my_param="my_param_value"
type="application/x-java-applet;version=1.6.0"
pluginspage="http://java.sun.com/j2se/1.6.0/download.html">
<noembed>No Java Support.</noembed>
</embed>
</comment>
</OBJECT>
</body>
</html>

----
This doesn't work either.
12 years ago
A little more info - if I put the class file itself on the web site in the same directory, this also works fine.
12 years ago
Hello -
The java file (this version has code that requires signing commented out - at this point I am just trying to get a jar'd class file to work.)

import java.applet.Applet;
import java.awt.Graphics;
import java.io.*;
import java.awt.Color;

/**
*
* A simple Signed Applet Demo
*
*/

public class SignedAppletDemo extends Applet {

public String test() {

setBackground(Color.white);

//String fileName = System.getProperty("user.home") +
// System.getProperty("file.separator") +
// "newfile";
String fileName = "c:\\java\\newfile";
String msg = "This message was written by a signed applet!!!\n";
String s ;

try {

//FileWriter fos = new FileWriter(fileName);
//fos.write(msg, 0, msg.length());
//fos.close();
s = new String("Successfully created file (not) :" + fileName);

} catch (Exception e) {
System.out.println("Exception e = " + e);
e.printStackTrace();
s = new String("Unable to create file : " + fileName);
}
return s;

}

public void paint(Graphics g) {

g.setColor(Color.blue);
g.drawString("Signed Applet Demo", 120, 50);
g.setColor(Color.magenta);
g.drawString(test(), 50, 100);
System.out.println("hello2");
}

}

I put this into a jar file with the commands -
javac SignedAppletDemo.java
jar cvf SignedAppletDemo.jar SignedAppletDemo.class

The html file -----
<html>
<head>
</head>
<body>
<applet code=SignedAppletDemo.class archive="SignedAppletDemo.jar"
width=100 height=100>
</applet>
</body>
</html>


The jar and html files are in the same folder.

When I run this on my machine (double clicking the html file in Explorer, which starts Chrome) it works fine. When I put these two files in the same directory on the web ( http://www.mathcarpenter.com/demo.html ) and navigate there with Chrome, I get a "class not found" error on SignedAppletDemo.class .

The jar file looks like this -
c:\Users\John\workspace2\documentsClient\src>jar tvf SignedAppletDemo.jar
0 Tue Aug 09 23:14:28 CDT 2011 META-INF/
71 Tue Aug 09 23:14:28 CDT 2011 META-INF/MANIFEST.MF
1460 Tue Aug 09 23:14:28 CDT 2011 SignedAppletDemo.class

The manifest file looks like this -
Manifest-Version: 1.0
Created-By: 1.6.0_26 (Sun Microsystems Inc.)

What am I missing?
12 years ago