exceptions that shouldn't be while trying to display a signed JApplet using the appletviewer

L

lbrtchx

I am getting
~
ClassNotFoundException . . . "Caused by" . . . FileNotFoundException
~
exceptions
~
C:\JApps\JApplet>appletviewer -J-Djava.security.policy=test00.policy
test00.html
load: class WP04_Japplet00 not found.
java.lang.ClassNotFoundException: WP04_Japplet00
at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
at sun.applet.AppletPanel.run(AppletPanel.java:361)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
\test00_signed.jar\test00.class (The system cannot find
the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:
70)
at
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:
161)
at
sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
at sun.applet.AppletClassLoader.access
$100(AppletClassLoader.java:44)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:
173)
at java.security.AccessController.doPrivileged(Native Method)
at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
... 8 more
~
the thing is that I can see the actual file right there in the jar
exactly where appletviewer is telling me it can not find it
~
C:\JApps\JApplet>jar -tvf test00_signed.jar
1962 Wed Jul 25 16:08:20 EDT 2007 META-INF/MANIFEST.MF
2083 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.SF
1095 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.DSA
0 Wed Jul 25 16:08:20 EDT 2007 META-INF/
828 Wed Jul 25 16:08:20 EDT 2007 AuthorCommentsBox00.class
669 Wed Jul 25 16:08:20 EDT 2007 JControls00.class
1956 Wed Jul 25 16:08:20 EDT 2007 LocalResource02.class
543 Wed Jul 25 16:08:20 EDT 2007 navBar00.class
573 Wed Jul 25 16:08:20 EDT 2007 navBarPix02.class
323 Wed Jul 25 16:08:20 EDT 2007
OptionsIndexOutOfBoundsException00.class
946 Wed Jul 25 16:08:20 EDT 2007 PixSel04.class
836 Wed Jul 25 16:08:20 EDT 2007 PixSelCtrl00.class
661 Wed Jul 25 16:08:20 EDT 2007 PixSelName04.class
286 Wed Jul 25 16:08:18 EDT 2007 PopUpAktnH00.class
3200 Wed Jul 25 16:08:18 EDT 2007 PUpAktn14.class
885 Wed Jul 25 16:08:18 EDT 2007 PUpSel00$1.class
1100 Wed Jul 25 16:08:18 EDT 2007 PUpSel00.class
892 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$1.class
589 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$2.class
2238 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00.class
1655 Wed Jul 25 16:08:20 EDT 2007 SldSpd04.class
738 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$1.class
720 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$2.class
1497 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02.class
1023 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02$BookInfo.class
5316 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02.class
8212 Wed Jul 25 16:08:20 EDT 2007 WP04_JApplet00.class
0 Tue Jul 24 17:31:28 EDT 2007 images/./
0 Tue Jul 24 17:31:28 EDT 2007 images/./gui/
946 Wed Feb 17 22:44:30 EST 1999 images/./gui/cut.gif
200 Mon Sep 04 09:06:32 EDT 2006 images/./gui/warning1.gif
0 Tue Jul 24 17:31:28 EDT 2007 images/./pix/
42499 Sun Sep 17 23:22:54 EDT 2006 images/./pix/BidOldMonkeyHalf.jpg
~
I am using windows
~
C:\JApps\JApplet>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
~
to sign the jar file and run the appletviewer with a batch file
~
SET _KD=WP04_JApplet00

SET _SNDKD=%_KD%_signed

SET _KSTR="keys.kstr"

SET _STRPW="password"

SET _DNM="[email protected], OU=wwwabc, O=org, L=noplace, ST=AR, C=US"

SET _ALIAS="(e-mail address removed)"

echo "// __ del(eting) %_KSTR%, *.jar, *.class"

del %_KSTR%

echo "del *.jar"
del *.jar

echo "del *.class"
del *.class

echo "// __ Compiling all classes in directory"

javac *.java

echo "// __ jar(ring) all classes in directory"

jar cvf0 %_KD%.jar *.class -C "images/" .

keytool -genkey -keystore %_KSTR% -storepass %_STRPW% -keypass %_STRPW
% -dname %_DNM% -alias %_ALIAS%

keytool -export -keystore %_KSTR% -storepass %_STRPW% -alias %_ALIAS% -
file %_KD%.cer

jarsigner -keystore %_KSTR% -storepass %_STRPW% -keypass %_STRPW% -
signedjar %_SNDKD%.jar %_KD%.jar %_ALIAS%

echo "del *.class"
del *.class

del %_KD%.jar

appletviewer -J-Djava.security.policy=%_KD%.policy %_KD%.html
~
which I have used without any problems in other cases
~
What is going on there?
~
Thanks
lbrtchx
 
L

lbrtchx

also, my java policy file looks like this:
~
keystore "keys.kstr";

grant codeBase "file:C:/JApps/JApplet/-" {
permission java.security.AllPermission;
};
 
N

Nigel Wade

Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
\test00_signed.jar\test00.class (The system cannot find
the path specified)
~
the thing is that I can see the actual file right there in the jar
exactly where appletviewer is telling me it can not find it
which I have used without any problems in other cases
~
What is going on there?

Which file can you see? I don't see a file called test00.class in your jar,
which is the file that the classloader says it cannot find. Maybe my eyesight
is failing?
 
T

Twisted

load: class WP04_Japplet00 not found.
8212 Wed Jul 25 16:08:20 EDT 2007 WP04_JApplet00.class

Oops. It's looking for "Japplet" but the closest you have is
"JApplet". Even if the Windoze machine you're using has a case-
insensitive filesystem, the jar file's inner filesystem and Java are
both case-sensitive and will see the difference. (Also, if the class
is internally named with a capital A it would still not have worked in
all likelihood. If it is internally named with a small a, then it
won't work even if you change the class to load to use a capital A to
match the jar file name. All three must match case, and with case
insensitive filesystems, the class name on the command line or in the
HTML code and the class name in the source file must still match case.)
 
L

lbrtchx

Sorry
~
actually the classes I was using were called WP04_Japplet00, etc,
naming/cases were consistent
~
the thing is that I trimmed down the example in order to debug it
using "test00" as the name of file
~
I am still having the problem, which I can notunderstand. Let me
reproduce it cleanly and repost it here
~
lbrtchx
 
R

Roedy Green

actually the classes I was using were called WP04_Japplet00, etc,
naming/cases were consistent

General rule. Tell the truth. When you tell fibs to simplify, you
often mask the source of the trouble. To simplify, simplify your
actual compilable source code, and quote the whole thing precisely.
This process often helps you solve your own problem. See
http://mindprod.com/jgloss/sscce.html

When you have more than one class, organise your classes into
packages. See http://mindprod.com/jgloss/package.html

"." not " _" separates package name from class.
 
L

lbrtchx

OK here it is
~
C:\JApps\JApplet>appletviewer -J-Djava.security.policy=test00.policy
test00.html
load: class test00 not found.
java.lang.ClassNotFoundException: test00
at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at
sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at
sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
at sun.applet.AppletPanel.run(AppletPanel.java:361)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
\test00_signed.jar\test00.class (The system cannot find the path
specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:
70)
at
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection....
161)
at
sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
at sun.applet.AppletClassLoader.access
$100(AppletClassLoader.java:44)
at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:
173)
at java.security.AccessController.doPrivileged(Native Method)
at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
... 8 more
~
the thing is that I can see the actual file right there in the jar
exactly where appletviewer is telling me it can not find it
~
C:\JApps\JApplet>jar -tvf test00_signed.jar
1962 Wed Jul 25 16:08:20 EDT 2007 META-INF/MANIFEST.MF
2083 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.SF
1095 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.DSA
0 Wed Jul 25 16:08:20 EDT 2007 META-INF/
828 Wed Jul 25 16:08:20 EDT 2007 AuthorCommentsBox00.class
669 Wed Jul 25 16:08:20 EDT 2007 JControls00.class
1956 Wed Jul 25 16:08:20 EDT 2007 LocalResource02.class
543 Wed Jul 25 16:08:20 EDT 2007 navBar00.class
573 Wed Jul 25 16:08:20 EDT 2007 navBarPix02.class
323 Wed Jul 25 16:08:20 EDT 2007
OptionsIndexOutOfBoundsException00.class
946 Wed Jul 25 16:08:20 EDT 2007 PixSel04.class
836 Wed Jul 25 16:08:20 EDT 2007 PixSelCtrl00.class
661 Wed Jul 25 16:08:20 EDT 2007 PixSelName04.class
286 Wed Jul 25 16:08:18 EDT 2007 PopUpAktnH00.class
3200 Wed Jul 25 16:08:18 EDT 2007 PUpAktn14.class
885 Wed Jul 25 16:08:18 EDT 2007 PUpSel00$1.class
1100 Wed Jul 25 16:08:18 EDT 2007 PUpSel00.class
892 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$1.class
589 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$2.class
2238 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00.class
1655 Wed Jul 25 16:08:20 EDT 2007 SldSpd04.class
738 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$1.class
720 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$2.class
1497 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02.class
1023 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02$BookInfo.class
5316 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02.class
8212 Wed Jul 25 16:08:20 EDT 2007 test00.class
0 Tue Jul 24 17:31:28 EDT 2007 images/./
0 Tue Jul 24 17:31:28 EDT 2007 images/./gui/
946 Wed Feb 17 22:44:30 EST 1999 images/./gui/cut.gif
200 Mon Sep 04 09:06:32 EDT 2006 images/./gui/warning1.gif
0 Tue Jul 24 17:31:28 EDT 2007 images/./pix/
42499 Sun Sep 17 23:22:54 EDT 2006 images/./pix/BidOldMonkeyHalf.jpg
~
I am using windows
~
C:\JApps\JApplet>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
~
to sign the jar file and run the appletviewer with a batch file
~
SET _KD=test00

SET _SNDKD=%_KD%_signed


SET _KSTR="keys.kstr"


SET _STRPW="password"


SET _DNM="(e-mail address removed), OU=wwwabc, O=org, L=noplace, ST=AR, C=US"


SET _ALIAS="(e-mail address removed)"


echo "// __ del(eting) %_KSTR%, *.jar, *.class"


del %_KSTR%


echo "del *.jar"
del *.jar


echo "del *.class"
del *.class


echo "// __ Compiling all classes in directory"


javac *.java


echo "// __ jar(ring) all classes in directory"


jar cvf0 %_KD%.jar *.class -C "images/" .


keytool -genkey -keystore %_KSTR% -storepass %_STRPW% -keypass
%_STRPW
% -dname %_DNM% -alias %_ALIAS%


keytool -export -keystore %_KSTR% -storepass %_STRPW% -alias %_ALIAS%
-
file %_KD%.cer


jarsigner -keystore %_KSTR% -storepass %_STRPW% -keypass %_STRPW% -
signedjar %_SNDKD%.jar %_KD%.jar %_ALIAS%


echo "del *.class"
del *.class


del %_KD%.jar

appletviewer -J-Djava.security.policy=%_KD%.policy %_KD%.html
~
also, my java policy file looks like this:
~
keystore "keys.kstr";

grant codeBase "file:C:/JApps/JApplet/-" {
permission java.security.AllPermission;
}
~
Thanks
lbrtchx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top