Page 4 of 6 FirstFirst ... 23456 LastLast
Results 61 to 80 of 101
  1. #61
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    Also Look at the API doc for the URL class
    If you don't understand my response, don't ignore it, ask a question.

  2. #62
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    Ok. I finally had the time to look up URL Protocol on the internet but I don't really get it still. (I suck at using the internet.) How do you look at the API doc?

  3. #63
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    Here's a link to the API doc:
    http://download.oracle.com/docs/cd/E...se/6/docs/api/
    Find the class in the lower left, click the link, the doc comes in the main frame.
    If you don't understand my response, don't ignore it, ask a question.

  4. #64
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    I got error 404. The link didn't work.

  5. #65
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    I guess oracle has disconnected that page. It has been working for months.
    Try this:
    http://docs.oracle.com/javase/6/docs/api/index.html
    Last edited by Norm; 03-25-2012 at 05:28 PM.
    If you don't understand my response, don't ignore it, ask a question.

  6. #66
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    Ok. I finally get what an URL is. But on this website: URLs [Learning HTML 3.2 by Examples],
    It says
    URLs, Uniform Resource Locators, are addresses of Web documents.
    .

    This game is not supposed to be a web document. Rather it is supposed to be just on a USB. So I don't know if this is going to work. But I guess what its looking for is the file URL. So I used this link:
    File URLs
    So do I just do: file:///C|/Users/Admin/Desktop/bin/Blocks.jar?

    Also, since this policy file is on the C drive and I'm going to put this game onto a USB, do I have to change anything? Like the location of the policy file maybe (and obviously the URL.)

  7. #67
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    So do I just do: file:///C|/Users/Admin/Desktop/bin/Blocks.jar?
    What happens when you tried that URL?

    since this policy file is on the C drive
    What policy file? Are you expecting the java program to find it or are you using the -D option for the java command?
    If you don't understand my response, don't ignore it, ask a question.

  8. #68
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    What happens when you tried that URL?
    It works fine and I managed to save it. It says:
    /* AUTOMATICALLY GENERATED ON Sat Mar 31 11:03:38 PDT 2012*/
    /* DO NOT EDIT */

    grant codeBase "file:///C|/Users/Admin/Desktop/bin/Blocks.jar" {
    permission java.io.FilePermission "<<ALL FILES>>", "write, read";
    };
    So I will test it soon.

    What policy file? Are you expecting the java program to find it or are you using the -D option for the java command?
    The policy file that I was just editing to make my program be able to read and write. I don't get the second question.

  9. #69
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    How does the java program use/find the policy file you created? Where is it located?
    If you don't understand my response, don't ignore it, ask a question.

  10. #70
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    Quote Originally Posted by Norm View Post
    How does the java program use/find the policy file you created? Where is it located?
    It doesn't. So I guess that's where things were going wrong and that is why I got the same exception. How do you make the java program use/find the policy file? It is located in C:/Users/Admin/.java.policy

  11. #71
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    The java program looks in the user.home directory. Write a short test program with to see where it is:
    System.out.println(System.getProperties().getPrope rty("user.home"));

    My .java.policy is at: C:\Users\Norm\.java.policy
    If you don't understand my response, don't ignore it, ask a question.

  12. #72
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    I did that in eclipse and it said
    C:\Users\Admin
    And when I did it as a jar, it just gave this error:
    java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertiesAccess(Un known Source)
    at java.lang.System.getProperties(Unknown Source)
    at Tetris.HighScores.<init>(HighScores.java:23)
    at Tetris.BlockController.<init>(BlockController.java :27)
    at Tetris.Tetris.init(Tetris.java:20)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    Exception in thread "Thread-12" java.lang.NullPointerException
    at Tetris.Tetris.run(Tetris.java:39)
    at java.lang.Thread.run(Unknown Source)

  13. #73
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    That looks like the policy file is in the correct location.
    For testing remove the URL from the policy file and see what happens.
    I have not been able to determine the correct URL for java classes run in a browser on my PC. I have tried lots of different URLs and have not found one that works in all browsers. Some worked in older versions of Firefox or Mozilla. I finally gave up for my applet that reads java doc files and set specific paths to the folders where the docs were in the grant to all URLs:

    grant {
    permission java.io.FilePermission "E:/Java/Java-1_6_0/docs", "read";
    permission java.io.FilePermission "E:/Java/tutorial", "read";
    };

    EDIT: Just noticed the error was for a Property permission, not file.
    Last edited by Norm; 03-31-2012 at 08:54 PM.
    If you don't understand my response, don't ignore it, ask a question.

  14. #74
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    So your telling me to just set codebase to blank? And what exactly did you mean by your edit?

  15. #75
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    Set it to blank to verify the policy file is being used.

    The last error you posted is not a FilePermission that is in your policy file. You need to add another permission to the policy file for PropertyPermission.
    If you don't understand my response, don't ignore it, ask a question.

  16. #76
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    I set the codebase to blank.

    I also added the PropertyPermission but it didn't fix anything.
    Shouldn't I somewhere, in the java program, call the policy file?

  17. #77
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    What error are you getting now? You've posted two different permission problems.

    The java program finds your .java.policy file based on pointers in its control files that point to the user.home folder.
    If you don't understand my response, don't ignore it, ask a question.

  18. #78
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    This error:
    java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertiesAccess(Un known Source)
    at java.lang.System.getProperties(Unknown Source)
    at Tetris.HighScores.<init>(HighScores.java:23)
    at Tetris.BlockController.<init>(BlockController.java :27)
    at Tetris.Tetris.init(Tetris.java:20)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    Exception in thread "Thread-12" java.lang.NullPointerException
    at Tetris.Tetris.run(Tetris.java:39)
    at java.lang.Thread.run(Unknown Source)

  19. #79
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,272
    Rep Power
    25

    Default Re: Java Applet Not Running on html.

    What does you policy file contain now?
    If you don't understand my response, don't ignore it, ask a question.

  20. #80
    Join Date
    Mar 2012
    Posts
    54
    Rep Power
    0

    Default Re: Java Applet Not Running on html.

    It says:
    /* AUTOMATICALLY GENERATED ON Sat Mar 31 12:17:12 PDT 2012*/
    /* DO NOT EDIT */

    grant {
    permission java.io.FilePermission "<<ALL FILES>>", "write, read";
    permission java.util.PropertyPermission "<<ALL FILES>>", "read, write";
    };

Page 4 of 6 FirstFirst ... 23456 LastLast

Similar Threads

  1. java applet not running when accessed from web
    By jobud9 in forum New To Java
    Replies: 3
    Last Post: 01-22-2012, 02:03 AM
  2. Replies: 7
    Last Post: 12-18-2011, 04:13 AM
  3. Applet Running in Java not from Cmd
    By vin_eets in forum Java Applets
    Replies: 1
    Last Post: 03-29-2011, 04:08 PM
  4. Running as Java Applet in eclipse
    By atomant in forum New To Java
    Replies: 0
    Last Post: 12-05-2010, 02:22 AM
  5. Java Applet Not Running
    By kahaj in forum Java Applets
    Replies: 4
    Last Post: 10-08-2009, 12:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •