0

I'm trying to run my application with Java Web Start, but only locally through my web browser without any servers. I created RunnableJar file of my application and then wrote jnlp file like this:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" 
    <information>
        <title>Title</title>
        <vendor>Me</vendor>
        <offline-allowed/>
    </information>
    <resources>
        <jar href="myApp.jar" main="true" />
        <j2se version="1.6+" href="http://java.sun.com./products/autodl/j2se"/>
    </resources>
    <application-desc>
         name="myApp"
         main-class="application.Main"
    </application-desc>
</jnlp>

But when I try to run it, I get "Application blocked by Java Security". I can't add any site to exceptions, because I'm not using any site. When I open Java Control Panel, my application is there in Temporary Internet Files in Cache Viewer, but when I try to open it, the same error occurs.

NotStudent
  • 39
  • 1
  • 10
  • https://www.baeldung.com/java-web-start according to here, you can try to add http://localhost:8080 to exception list – Saim Doruklu Jun 09 '19 at 20:21
  • @SaimDoruklu When I added it, I still get security error. When I add codebase="myApp.jnlp" I get an exception: ```com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/User/Desktop/JNLP/myApp.jnlp/myApp.jar ``` – NotStudent Jun 09 '19 at 20:40
  • did you try to add href="" https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/jnlpFileSyntax.html – Saim Doruklu Jun 09 '19 at 20:44
  • Yes I did. If I add href="" without specifying codebase I still get a security error, and when I add href="" without codebase I get the same error as above. – NotStudent Jun 09 '19 at 20:48
  • https://stackoverflow.com/a/38395129/5313017 – Saim Doruklu Jun 09 '19 at 20:51
  • Now I get ```java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setFactory")``` – NotStudent Jun 09 '19 at 21:01
  • does this help https://stackoverflow.com/a/10455089/5313017 – Saim Doruklu Jun 09 '19 at 21:09
  • I have no idea where ```\lib\security\java.policy``` is. – NotStudent Jun 09 '19 at 21:19
  • it should be in somewhere like `C:/Program Files/Java/jdk or jre/lib` if you are using windows for linux you can find java home using `which java` – Saim Doruklu Jun 09 '19 at 21:22
  • I found a couple of java.policy files and added ```permission java.security.AllPermission;``` in all of them but I still get ava.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setFactory") error. – NotStudent Jun 09 '19 at 21:32
  • did you try debugging https://stackoverflow.com/a/26551646/5313017 – Saim Doruklu Jun 09 '19 at 21:51
  • Still nothing, thank you though. – NotStudent Jun 09 '19 at 22:31

0 Answers0