java - 在网页上获取 Netbeans Applet

标签 java netbeans applet java-web-start

好的,我将完成到目前为止的所有步骤,以便有希望地加快这个过程。我以前做过这个,但是有一段时间了,我忘记了怎么做,但我知道这是可能的。

  1. 我制作了一个 Neatbeans 创建的 Java 应用程序。 然后按照本文所说(我记得为其他程序这样做)我做了以下事情:
  1. Right-click the package containing your app and choose New | Other.
  2. Select the Swing GUI Forms category and choose JApplet Form. (This template is one of several applet templates, but this one is the one you want to create a JApplet that you can design in the GUI Builder.)
  3. In the editor window, select the tab for the form that you want to convert to an applet.
  4. In the Inspector window, select the sub-components of the form and press Ctrl-C (or Ctrl-X) to copy them.
  5. In the editor window, select the tab for the JApplet form that you have just created.
  6. In the Inspector window, right-click the JApplet node and press Ctrl-V to paste the components.

2.之后,我右键单击了我的项目“ConsulantsStaff”(是的,它拼错了),然后转到 Web Start 并进行了以下更改: enter image description here

3.然后我运行了 Clean and Build,然后在线上传了项目“dist”文件夹中的文件。 这些文件是:ConsulantsStaff.jar、launch.html、launch.jnlp

4.然后我尝试将其合并到一个 HTML 文件中,该文件现在如下所示:

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><!-- ########################## IMPORTANT NOTE ############################ --><!-- This preview HTML page will work only with JDK 6 update 10 and higher! --><!-- ###################################################################### -->
    <html>
    <head>
    <title>Consulants Applet</title>
    </head>
    <body>
    <body bgcolor="#000000">
    <h3></h3>
    <script src="http://java.com/js/deployJava.js"></script>
    <script>
    var attributes = {
    code: "mypackage.consulantsstaff",
    archive: "consulantsstaff.jar",
    width: 800,
    height: 740
    };
    var parameters = {jnlp_href:"launch.jnlp"}; <!-- Applet Parameters -->
    var version = "1.5"; <!-- Required Java Version -->
    deployJava.runApplet(attributes, parameters, version);
    </script><!-- Or use the following applet element to launch the applet using jnlp_href --><!--
    <applet width="300" height="300">
    <param name="jnlp_href" value="launch.jnlp"/></applet>
    -->
    </body>
    </html>

所以......是的,我真正记得做的唯一一步是第 1 步,其余的我正在努力,到目前为止它没有用。 这个小程序当前位置在这里,现在只是黑屏:Applet

感谢所有帮助, -奥斯汀 (我在两个网站上发布了这篇文章,因为我需要尽快得到答复,在此先感谢大家!)

最佳答案

java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
...
    at javax.swing.JFrame.setDefaultCloseOperation(JFrame.java:372)
    at consulantsstaff.UpdateUser.initComponents(UpdateUser.java:48)

你打电话了吗..

JFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

..在 UpdateUser 的第 48 行?这是我最好的猜测。即使是受信任的小程序也不允许退出 VM(或创建执行相同操作的框架)。

顺便说一句 - 你真的应该在获得 44 Kb 的签名代码之前弄清楚这一点!


也许是这个应用程序。实际上需要是一个基于 JFrame 的应用程序。从使用 Java Web Start 的链接启动(出于多种原因,包括使用 JWS 启动的沙盒 框架 可以毫无问题地进行该方法调用)。

关于java - 在网页上获取 Netbeans Applet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9854896/

相关文章:

java - 插入排序与字符串的困难

java - 编译 Petstore 2

java - 如何从 NetBeans 生成的类中取回原始对象以供 JAX-WS 传输?

java - 导入 csv 文件以填充 Netbeans 中表中的数据

java - 通过网络加载的小程序和通过文件系统加载的小程序有什么区别?

java - 即使在manifest.xml中声明,Android权限错误

java - 我的 pom.xml 出现 Maven 错误

java - Netbeans:如何更改 JTree 的外观

java - 在浏览器中运行的自签名小程序无法复制文件、由编写器写入、编码等

java - 小程序 CLASS_NOT_FOUND_EXCEPTION