如何注册一个Java小程序在浏览器中使用? [英] How do I sign a Java applet for use in a browser?

查看:165
本文介绍了如何注册一个Java小程序在浏览器中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署在我的网站的Java小程序。我还需要签署它,因为我需要访问剪贴板上。我已经照着所有的教程签署我能找到但没有成功。以下是我迄今所做的:


  • 在NetBeans的写一个小程序。它运行在applet浏览器的罚款。

  • 做了一个.jar文件出来。

  • 将这样创建的证书:


 的keytool -genkey -keyalg RSA -alias myKeyName
密钥工具-export -alias myKeyName -file myCertName.crt



  • 签署wtih的jarsigner是这样的:


 的jarsignerC:\\我的路径\\ myJar.jarmyKeyName



  • 由含该HTML文件:


 < HTML和GT;
  <身体GT;
<小程序code =我的/路径/名/ myApplet.class档案=../ DIST / myJar.jar/>
  < /身体GT;
< / HTML>


当我打开该HTML文件时,我从来没有得到安全确认对话框(并因此获得了java.security.AccessControlException:拒绝访问错误)。这发生在所有浏览器。

我缺少的一个步骤?


解决方案

也许是因为你打开的以外的一些.class文件的 jar文件?

这样,它可能不会显示警告。我想这样做这种方式,但它仍然给我看证书的警告和一个简单的情况下,它实际上是$ P $从JAR访问类与分离类pvented我。

也许你的特定设置或文件组织会导致行为。如果你能布局更加详细,我们可以帮助人们更好地(或者说,尝试将所有的.class文件中又签署罐,并把它添加到压缩文件......,anotherJar.jar)。

I'm trying to deploy a Java applet on my website. I also need to sign it, because I need to access the clipboard. I've followed all the signing tutorials I could find but have not had any success. Here is what I've done so far:

  • Wrote an applet in NetBeans. It runs fine in the applet viewer.
  • Made a .jar file out of it.
  • Created a certificate by doing this:

keytool -genkey -keyalg rsa -alias myKeyName
keytool -export -alias myKeyName -file myCertName.crt

  • Signed it wtih jarsigner like this:

jarsigner "C:\my path\myJar.jar" myKeyName

  • Made an html file containing this:

<html>
  <body>
<applet code="my/path/name/myApplet.class" archive="../dist/myJar.jar"/>
  </body>
</html>

When I open that html file, I never get the security confirmation dialog box (and thus get the "java.security.AccessControlException: access denied" error). This happens on all browsers.

Am I missing a step?

解决方案

Perhaps it's because you're opening some .class files outside the jar file?

That way it may not display the warning. I tried doing it that way but it still showed me the certificate warning and for a simple case it actually prevented me from accessing a class from the JAR with the separated class.

Maybe your specific setup or file organization causes that behavior. If you can layout that in more detail we could help better (or rather, try putting all those .class files in yet another signed Jar and add it to the archive"..., anotherJar.jar").

这篇关于如何注册一个Java小程序在浏览器中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆