一步步签名java小程序
我正在编写一个java小程序,它使用 org.apache.commons.net.ftp.FTP 从小程序在 eclipse 中工作的网页将文件上传到 ftp 服务器
。
我的项目包含 Uploader.java、FtpUpload_thread.java 和 commons-net-2.2.jar ( import org.apache.commons.net.ftp.FTP) 文件..
我使用 cmd 命令编译我的类:
javac *.java -cp *.jar
我将类放入 html 中:
<applet code="Uploader.class" codebase="./" archive="commons-net-2.2.jar" width="600" height="230"></applet>
但是当我尝试建立连接时出现错误:
java.security.AccessControlException: access denied (java.net.SocketPermission /*myftp*/ resolve)
所以我必须签名我的小程序..
我制作我的 jar 文件:
jar cvf Uploader.jar Uploader.class FtpUpload_thread.class commons-net-2.2.jar
- < p>我生成密钥:
keytool -genkey -alias signFiles -keystore compstore
,然后输入程序所需的值。 现在我有了 compstore 数据库文件
我签署了 JAR 文件
jarsigner -keystore compstore -storepass 通行证 -keypass 通行证 -signedjar UploaderS.jar Uploader.jar signFiles
和我有 UploaderS.jar 文件,
所以现在我有我的文件夹:
Uploader.jar
UploaderS.jar
compstore
Uploader.class
commons-net-2.2.jar
FtpUpload_thread.class
这是全部还是我需要其他步骤?
放置我的签名小程序并以权限运行它的 html 代码是什么?
谢谢!
I'm writing a java applet that uses
org.apache.commons.net.ftp.FTP to upload a file to an ftp server from a webpage
the applet works in eclipse..
My project contains Uploader.java, FtpUpload_thread.java and the commons-net-2.2.jar (to import org.apache.commons.net.ftp.FTP) files..
I compile my classes using the cmd command:
javac *.java -cp *.jar
I put the class in html:
<applet code="Uploader.class" codebase="./" archive="commons-net-2.2.jar" width="600" height="230"></applet>
but when I try to establish the connection I get the error:
java.security.AccessControlException: access denied (java.net.SocketPermission /*myftp*/ resolve)
So I have to sign my applet..
I make my jar file:
jar cvf Uploader.jar Uploader.class FtpUpload_thread.class commons-net-2.2.jar
I generate keys:
keytool -genkey -alias signFiles -keystore compstore
and then I put the values that the program requires..
now I have the compstore database file
I Sign the JAR File
jarsigner -keystore compstore -storepass pass
-keypass pass
-signedjar
UploaderS.jar Uploader.jar signFiles
and I have the UploaderS.jar file
so now I have my folder with:
Uploader.jar
UploaderS.jar
compstore
Uploader.class
commons-net-2.2.jar
FtpUpload_thread.class
it's all or I need other steps?
what is the html code to put my sign applet and run it with permissions?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 java 插件而不是
您必须指定您的类所需的所有 jar 并使用签名的存档,
我还建议在您的 applet 类上放置一个包。
我不知道如何指定小程序使用的权限。
希望这有帮助。
I would recommend utilizing the java plugin as opposed to the <applet> tag.
You will have to specify all the jars required by your class and use the signed archive
I would also recommend putting a package on your applet class.
I am not sure how to go about specifying the permissions to use by the applet.
Hope this helps.