如果我正确地阅读了JavaFX部署指南,我应该能够部署未签名的应用程序,只要“该应用程序需要[没有]提升的权限......”。我在我的应用程序已经减少到下面的代码位:通过JNLP启动程序会产生安全异常
package fxadhoc;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
public class FXAdHoc
extends Application
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
System.out.println("launch");
launch(args);
}
@Override
public void start(Stage stage) throws Exception
{
Pane root = new Pane();
root.getChildren().add(new Label("Testing"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
}
当我双击jar文件(通过NetBeans中创建)什么也不会发生。当我尝试通过HTML或JNLP文件(也由NetBeans中创建)推出我得到一个安全异常:
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "javafx.debug" "read")
完整的堆栈跟踪如下。
我正在运行Windows 7并应用了所有最新更新。我已经下载了最新版本的NetBeans(7.1.1),它配备了最新版本的JavaFX。我已经下载了JavaFX示例,并且它们运行良好。 (如果您好奇,我尝试自签名应用程序并得到异常“ava.lang.RuntimeException:java.lang.UnsatisfiedLinkError:无法加载库:C:\ Users \ jack \ Documents \ NetBeansProjects \ FXAdHoc \ DIST \ BIN \ mat.dll“)。当我在Linux上构建时(同样使用NetBeans 7.1.1),我会遇到同样的异常。
有谁能告诉我我错过了什么吗?谢谢...
为异常的完整堆栈跟踪:
java.lang.RuntimeException: Application launch error
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:104)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ExceptionInInitializerError
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:140)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:27)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:97)
... 1 more
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "javafx.debug" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at com.sun.javafx.runtime.SystemProperties.getProperty(SystemProperties.java:178)
at com.sun.javafx.runtime.SystemProperties$1.run(SystemProperties.java:67)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.runtime.SystemProperties.<clinit>(SystemProperties.java:62)
... 4 more
尝试后[JavaFX的开发者预览版(http://www.oracle.com/technetwork/java/javafx/downloads/devpreview-1429449.html)和提版本和构建你试过数。尝试以jnlp的身份运行[Getting Started NetBeans Project](http://docs.oracle.com/javafx/2.0/get_started/ColorfulCircles.zip)并查看是否有效。 – jewelsea 2012-04-23 21:45:59