Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 14 of 14

Thread: JApplet Not Running In Firefox

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default JApplet Not Running In Firefox

    Hello everyone, I have a JApplet that is embedded in a website and refuses to run in Firefox. The java environment just shuts down after a little bit of time, no reported errors or anything, just stops running. I've confirmed it happens on more than one machine and I've confirmed that the JApplet works fine in Chrome.

    Here is the url if anyone wants to see what I mean: Airline Management Simulation Game

    Any ideas as to what would cause this to happen?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: JApplet Not Running In Firefox

    Yikes, yeah, you've got a serious error in there somewhere that's causing Java to exit entirely (it crashed another applet I also had running). I don't see an error message or anything either. What kinds of weird stuff are you doing?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default Re: JApplet Not Running In Firefox

    Just reading some text files on the website, nothing too ridiculous. Why would it crash firefox but not chrome though?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: JApplet Not Running In Firefox

    That's a really good question, and unfortunately, I have no idea. Are you using any plugins or calling javascript or anything like that?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,286
    Thanks
    56
    Thanked 2,372 Times in 2,343 Posts

    Default Re: JApplet Not Running In Firefox

    When I downloaded it and tried to load it into a browser I get this in the java console:

    java.security.AccessControlException: access denied (java.net.SocketPermission airlinemanagegame.zxq.net:80 connect,resolve)

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: JApplet Not Running In Firefox

    How are you doing the reading of the files?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default Re: JApplet Not Running In Firefox

    Quote Originally Posted by KevinWorkman View Post
    That's a really good question, and unfortunately, I have no idea. Are you using any plugins or calling javascript or anything like that?
    No, I'm not calling any external stuff other than text files.

    When I downloaded it and tried to load it into a browser I get this in the java console:

    java.security.AccessControlException: access denied (java.net.SocketPermission airlinemanagegame.zxq.net:80 connect,resolve)
    Did you run it from the website or try to run it locally? If you tried the first, try again because I was just making changes and you might have got caught between the 6 re-uploads I just did. If you did the latter, then I wouldn't expect it to work since you cannot access the data files from an external source.

    How are you doing the reading of the files?
    1) Creating a URL (using http, not ftp) to the file
    2) Creating a URLConnection to the URL
    3) Creating a BufferedReader and sending it a new InputStreamReader, which I am sending the InputStream of the URLConnection
    4) Using the readLine() method to get each line.

    Pretty basic.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,286
    Thanks
    56
    Thanked 2,372 Times in 2,343 Posts

    Default Re: JApplet Not Running In Firefox

    What files?
    I have a utility I use to get a website's files. I downloaded the html and the jar files and run a test from anhtml file on my pc. I also wrote an applet wrapper so I can run it as an Application with a security manager.
    It looks like it does some FTP stuff: port 21 and then some more ports for the transfers. Then it prompts me for userid and password or New Account. When I enter a new account it goes away for a while and I eventually close it.

  9. #9
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default Re: JApplet Not Running In Firefox

    Quote Originally Posted by Norm View Post
    What files?
    I have a utility I use to get a website's files. I downloaded the html and the jar files and run a test from anhtml file on my pc. I also wrote an applet wrapper so I can run it as an Application with a security manager.
    It looks like it does some FTP stuff: port 21 and then some more ports for the transfers. Then it prompts me for userid and password or New Account. When I enter a new account it goes away for a while and I eventually close it.
    In order to create a new account, it does an FTP call to a file, but it uses the specific URL of the file instead of a local call to the file (if you are loading an already existing account, it simply reads the online file instead of doing an FTP call). So when you are creating the new account, it is trying to do the FTP call to the online file, which it cannot do because my host does not allow remote access to any files. Interestingly enough, there is a new account named: _test_company. Is that yours?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,286
    Thanks
    56
    Thanked 2,372 Times in 2,343 Posts

    Default Re: JApplet Not Running In Firefox

    No, I used something like: asdfasdf

  11. #11
    Member
    Join Date
    Aug 2011
    Posts
    48
    My Mood
    Fine
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: JApplet Not Running In Firefox

    Quote Originally Posted by aussiemcgr View Post
    Just reading some text files on the website, nothing too ridiculous. Why would it crash firefox but not chrome though?
    Applet is always running inside a restricted environment called SandBox, you need to assign permission to your Applet either by providing .java.policy permission on client computer, or by signing the applet using keytool and jarsigner utilities.

    Have a read:

    Signed Applets

    Grant the Required Permission

    immutable objects
    Last edited by ha.minh.nam; December 4th, 2011 at 07:27 PM.

  12. #12
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default Re: JApplet Not Running In Firefox

    Quote Originally Posted by ha.minh.nam View Post
    Applet is always running inside a restricted environment called SandBox, you need to assign permission to your Applet either by providing .java.policy permission on client computer, or by signing the applet using keytool and jarsigner utilities.

    Have a read:

    Signed Applets

    Grant the Required Permission
    The problem is fixed now, but for clarification: That is only true when you are trying to access the client computer. The data files I was reading was local to the applet on the web server. Since the files are located on the web server instead of the client computer, additional permissions are not required to read them.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  13. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,286
    Thanks
    56
    Thanked 2,372 Times in 2,343 Posts

    Default Re: JApplet Not Running In Firefox

    The problem is fixed now,
    Can you tell us what the fix was?

  14. #14
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,707
    Thanks
    25
    Thanked 338 Times in 313 Posts

    Default Re: JApplet Not Running In Firefox

    Quote Originally Posted by Norm View Post
    Can you tell us what the fix was?
    I'm not entirely sure. All I did was put the file reading on a separate thread and now it works. Maybe there is something weird with firefox where it was crashing the thread or something, but all I know is that it now works...
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. initializing a java JApplet
    By j_a_lyons in forum Java Theory & Questions
    Replies: 0
    Last Post: January 8th, 2011, 04:49 PM
  2. japplet - jtable - browser
    By jasonnuigi in forum AWT / Java Swing
    Replies: 4
    Last Post: January 2nd, 2011, 05:20 AM
  3. Convert Application to JApplet
    By MikeSki3 in forum AWT / Java Swing
    Replies: 2
    Last Post: May 12th, 2010, 02:20 PM
  4. java maskeraiding as firefox - how?
    By chopficaro in forum Java Theory & Questions
    Replies: 2
    Last Post: May 11th, 2010, 04:17 AM
  5. Cannot update Jlabel in JApplet
    By rin in forum Java Applets
    Replies: 2
    Last Post: April 17th, 2010, 09:21 AM