如何使用 NetBeans 自签名小程序? [英] How to self-sign an applet with NetBeans?

查看:35
本文介绍了如何使用 NetBeans 自签名小程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在前几个月,我为一个学术项目开发了一个沙盒小程序.由于Java 1.7.51 对applet 的安全限制,我一直在尝试对我的applet 进行自签名,希望它能够符合或克服JRE 对applet 的要求.

In the previous months I developed a sandbox applet for an academic project. Due to the Java 1.7.51 security restrictions to applets, I have been trying to self-sign my applet with the hope that it can comply or overcome JRE's requisites for applets.

我正在使用 NetBeans,并且我已经将一些显示如何对 jar 文件进行自签名的链接作为出发点.不幸的是,我一直无法让它工作.

I'm using NetBeans and I have taken as a point of departure some links that show how to self-sign a jar file. Unfortunately, I haven't been able to get it working.

我尝试在 build.xml 文件中添加以下说明:

I have tried to add the following instructions on the build.xml file:

<target name="-post-jar" depends="signing_procedure">
</target>

<target name="signing_procedure" depends="">
    <echo message="Signing ${dist.dir}/MyFile.jar"/>
    <exec dir="C:/Program Files/Java/jdk1.7.0_25/bin/" executable="jarsigner.exe">
        <arg value="-verbose" />
        <arg value="-keystore" />
        <arg value="C:/Program Files/Java/jdk1.7.0_25/bin/MyKeyStore.jks" />
        <arg value="-storepass" />
        <arg value="mystorepass" />
        <arg value="-keypass" />
        <arg value="mykeypass" />
        <arg value="C:/Users/Charles/Documents/ProjectsFolder/MyProject/dist/MyFile.jar" />
        <arg value="MyAlias" />
    </exec>
</target>

我收到以下错误消息:

Execute failed: java.io.IOException: Cannot run program "jarsigner.exe": error=2, The specified file is not found

我将深深感谢您的帮助,如果是 NetBeans,我将感激不尽!

I would deeply thank you for your help, and much more if it is adressed to NetBeans!

推荐答案

我想出了如何去做.需要将以下几行添加到 build.xml 中,在 NetBeans 上相应项目的选项卡 Files 下:

I figured out how to do it. The following lines need to be added to the build.xml, under the tab Files of the corresponding project on NetBeans:

<target name="-post-jar" depends="Signing Procedure">
</target>

<target name="Signing procedure" depends="">
    <echo message="Signing ${dist.dir}/MyAppet.jar..."/>
    <exec dir="${dist.dir}" executable="C:/Program Files/Java/jdk1.7.0_25/bin/jarsigner.exe">
        <arg value="-verbose" />
        <arg value="-keystore" />
        <arg value="C:/Program Files/Java/jdk1.7.0_25/bin/MyKeyStore.jks" />
        <arg value="-storepass" />
        <arg value="mystorepassword" />
        <arg value="-keypass" />
        <arg value="mykeypassword" />
        <arg value="C:/Users/Charles/Documents/MyNetBeansProjects/MyProject/dist/MyApplet.jar" />
        <arg value="MySelfSignatureAlias" />
    </exec>
</target>

我希望这对其他用户有用!

I hope this is useful to other users!

这篇关于如何使用 NetBeans 自签名小程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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