简体   繁体   English

运行Java小程序时出错

[英]Error when run the java applet

I have did the following steps to create Creating Self-Signed Applets 我已执行以下步骤来创建“创建自签名小程序”

Also, it gave me error when i run on the html page, I use both HTML 4.1 and HTML5 另外,当我在html页面上运行时,它给了我错误,我同时使用HTML 4.1和HTML5

eytool -genkey -keystore mykeystore -alias myalias
Enter keystore password:  mypassword
What is your first and last name?
  [Unknown]:  
What is the name of your organizational unit?
  [Unknown]: 
What is the name of your organization?
  [Unknown]:  
What is the name of your City or Locality?
  [Unknown]: 
What is the name of your State or Province?
  [Unknown]:  
What is the two-letter country code for this unit?
  [Unknown]:  
  [no]:  yes
Enter key password for <myalias>
            (RETURN if same as keystore password):


and create mykeystore but i used jdk 1.7.0
after that i created the jar file by the following steps

C:\Users\Rahand\Desktop\draft>javac AudioRecording.java

C:\Users\Rahand\Desktop\draft>jar cvf AudioRecording.jar *.class
added manifest
adding: AudioRecording$1.class(in = 673) (out= 445)(deflated 33%)
adding: AudioRecording$2.class(in = 812) (out= 499)(deflated 38%)
adding: AudioRecording$CaptureThread.class(in = 1840) (out= 983)(deflated 46%)
adding: AudioRecording.class(in = 3227) (out= 1723)(deflated 46%)

C:\Users\Rahand\Desktop\draft>pack200 -r AudioRecording.jar


C:\Users\Rahand\Desktop\draft>jarsigner -keystore mykeystore -storepass (secretkye) -keypass (secretkye) AudioRecordin
g.jar myalias

Warning:
The signer certificate will expire within six months.

but when i run on the web the program has the following error 但是当我在网络上运行时,程序出现以下错误

load: class JavaSound.class” />  <param name= not found.
java.lang.ClassNotFoundException: JavaSound.class” .>  <param name=
    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: JavaSound.class” .>  <param name=

i am appreciated if help me to solve this problem... Thanks 如果能帮助我解决这个问题,我表示感谢...谢谢

As per your stacktrace : 根据您的stacktrace:

 java.lang.ClassNotFoundException: JavaSound.class

Does JavaSound.class really exists in your jar file? 您的jar文件中确实存在JavaSound.class吗?

because when I see the jar compile stacke it looks like : 因为当我看到jar编译堆栈时,它看起来像:

adding: AudioRecording$1.class(in = 673) (out= 445)(deflated 33%)
adding: AudioRecording$2.class(in = 812) (out= 499)(deflated 38%)
adding: AudioRecording$CaptureThread.class(in = 1840) (out= 983)(deflated 46%)
adding: AudioRecording.class(in = 3227) (out= 1723)(deflated 46%)

There is no class as JavaSound int your compiled jar file. 没有类,因为JavaSound int您的已编译jar文件。

you should use AudioRecording.class instead of JavaSound.class in your param value 您应该在param value使用AudioRecording.class而不是JavaSound.class

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM