Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaFX应用程序中的AccessControlException_Java_Web Applications_Javafx 2_Accesscontrolexception - Fatal编程技术网

JavaFX应用程序中的AccessControlException

JavaFX应用程序中的AccessControlException,java,web-applications,javafx-2,accesscontrolexception,Java,Web Applications,Javafx 2,Accesscontrolexception,我正在尝试在网页中嵌入JavaFX音乐播放器。此JavaFX应用程序在web启动模式下运行良好。但当我试图在web模式下运行它,或者试图在构建后访问它的网页时,它会给我AccessControlException。错误消息如下所示: Match: beginTraversal Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null, href=http://java.sun.com/produ

我正在尝试在网页中嵌入JavaFX音乐播放器。此JavaFX应用程序在web启动模式下运行良好。但当我试图在web模式下运行它,或者试图在构建后访问它的网页时,它会给我AccessControlException。错误消息如下所示:

    Match: beginTraversal
Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null, href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
    platform is: 1.7
    product is: 1.7.0_13
    location is: http://java.sun.com/products/autodl/j2se
    path is: C:\Program Files\Java\jre7\bin\javaw.exe
    args is: null
    native platform is: Windows, x86 [ x86, 32bit ]
    JavaFX runtime is: JavaFX 2.2.5 found at C:\Program Files\Java\jre7\
    enabled is: true
    registered is: true
    system is: true

    Match: ignoring maxHeap: -1
    Match: ignoring InitHeap: -1
    Match: digesting vmargs: null
    Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
    Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
    Match: digest LaunchDesc: file:/C:/Users/lenovo/Documents/NetBeansProjects/MusicPlay/dist/MusicPlay.jnlp
    Match: digest properties: []
    Match: JVM args: [JVMParameters: isSecure: true, args: ]
    Match: endTraversal ..
    Match: JVM args final: 
    Match: Running JREInfo Version    match: 1.7.0.13 == 1.7.0.13
     Match: Running JVM args match: have:<>  satisfy want:<>
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.dir" "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 java.io.Win32FileSystem.getUserPath(Unknown Source)
    at java.io.Win32FileSystem.resolve(Unknown Source)
    at java.io.File.getAbsolutePath(Unknown Source)
    at java.io.File.getAbsoluteFile(Unknown Source)
    at java.io.File.toURI(Unknown Source)
    at musicplay.MusicPlay.start(MusicPlay.java:90)
    at com.sun.javafx.applet.FXApplet2$1.run(FXApplet2.java:131)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Unknown Source)
CacheEntry[file:/C:/Users/lenovo/Documents/NetBeansProjects/MusicPlay/dist/MusicPlay.jnlp]: updateAvailable=true,lastModified=Mon Feb 04 18:25:32 IST 2013,length=948
CacheEntry[file:/C:/Users/lenovo/Documents/NetBeansProjects/MusicPlay/dist/MusicPlay.jnlp]: updateAvailable=true,lastModified=Mon Feb 04 18:25:32 IST 2013,length=948
CacheEntry[file:/C:/Users/lenovo/Documents/NetBeansProjects/MusicPlay/dist/MusicPlay.jar]: updateAvailable=false,lastModified=Mon Feb 04 18:46:10 IST 2013,length=31879
Java Plug-in 10.13.2.20
Using JRE version 1.7.0_13-b20 Java HotSpot(TM) Client VM
User home directory = C:\Users\lenovo
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
但它仍然给了我同样的信息。任何帮助都将不胜感激

我自己找到了答案。 在网页中嵌入JavaFX应用程序时。不允许您的应用程序(或网页)访问本地文件结构。我以前也试着这么做。我正在传递歌曲文件的路径。 但实际上,您需要将媒体文件托管在某些服务器目录中,例如Apache服务器目录。网页可以轻松访问Apache服务器目录。您需要将媒体文件的URI传递到应用程序中。 示例
currentFile=”http://localhost/songs/Jaane_Kaise.mp3";

    grant codeBase "file:*" {
        permission java.security.AllPermission;
};