• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Game Tutorials -->> Exploring Browser Support for Java 2

 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is part of the package of Game Tutorials threads, for which a complete listing of threads can be found in The Table Of Contents.
Installing Java 2 Plug-In support for Internet Explorer or Netscape 6 is a rather straight-forward process as is specifying the default use of the Java 2 Plug-In - just visit Sun's Java Plug-In Home Page and follow the instructions. With Netscape 4, installation turns out to be just as easy, but it's not apparent that the installation is occurring. Also, specifying the Java 2 Plug-In for default use doesn't seem to be an option with Netscape 4.
The goal of this exercise was to get Java 1.4 working in Netscape 4 and to learn the html tags necessary to use the desired Java plug-in. Here's what I did:
  • Installed Netscape 4.08
  • Help -> About Plug-Ins revealed that only a "Netscape Default Plug-in" is installed and enabled (it appeared to have nothing to do with Java)
  • [list]Tested out any possible Java support by viewing JavaVersion using the APPLET tag:Resulted in an error message in the status bar: "Applet JavaVersion error: java.lang.ClassFormatError: Bad major version number"
    That was decidedly not the result I was expecting and it did seem to work just fine with Internet Explorer. Thought for a moment then recompiled with javac -target 1.1 and it worked - Version 1.1.5 was in use by Netscape.
  • Downloaded and installed JRE 1.4.0_01 from http://java.sun.com/j2se/1.4/download.html . As Netscape 4 wasn't offered as a choice in the plug-in list, I chose Netscape 6 to see what might happen (I did not have Netscape 6 installed).
  • Suddenly, lots of Plug-In listing were found in Help -> About Plug-Ins . I browsed to the aforementioned test page, but sadly only Java 1.1.5 is still in use by default. Note that the suggestion of setting the default plug-in through the Java Plug-In Control Panel as mentioned here http://java.sun.com/getjava/setting-default.html does not work for Netscape 4. Go figure...
  • Read up on using this html EMBED tag stuff to tell Netscape to use a newer plug-in rather than the default Java support at http://java.sun.com/products/plugin/versions.html and http://www.tornadolabs.com/News/Java_Plugin/java_plugin.html
  • [list]Made a new html document, JavaVersion_02, with this:Success! The Java Plug-In version 1.4.0_01 was used. Problem: Internet Explorer doesn't know what to do with the EMBED tag...
  • So, with the APPLET, tag Netscape 4 uses the default Java support and IE uses the newest Java plug-in installed and enabled. With the EMBED tag, Netscape 4 does what we want, but IE doesn't know what that tag is and displays a big blank rectangle. With the OBJECT tag, IE is supposed to know what to do (except when I try it IE crashes), but Netscape 4 doesn't know what the tag means and just ignores it and displays nothing. This is not a perfect situation. Time to figure out what the pros do...
  • I found a Swing Applet in Sun's Java Tutorial at http://java.sun.com/docs/books/tutorial/uiswing/start/HelloSwingApplet.html and took a look at the source for the page. They cheated big time. They used JavaScript to produce different tags depending on the user's browser. This was not the solution I was hoping for.
  • Did some more reading on the subject at http://java.sun.com/docs/books/tutorial/uiswing/start/swingApplet.html and http://java.sun.com/products/jfc/tsc/articles/applets/index.html where I found a bunch of outdated nonsense and missing articles. I was disappointed in Sun.
  • Conclusion: I figured out how to install Java 1.4 support in Netscape 4 and how to use JavaScript to generate the proper HTML tag depending on the browser in order to properly view a Java 1.4 applet. Using JavaScript was not what I was hoping to do, and I'll be keeping an eye out for a different solution.
    Do you have any ideas or questions?
    [ June 14, 2002: Message edited by: Dirk Schreckmann ]
     
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I've used this successfully with the 1.3.1 plugin.
    [ June 09, 2002: Message edited by: Dirk Schreckmann ]
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Ooooh - a COMMENT tag! Nice. I like that much more than using JavaScript.
    Thanks Marilyn
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I cannot get Marilyn's suggestion to work properly. The problems seem to be numerous.
    I'm trying to figure this one out a bit more...
     
    author
    Posts: 14112
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Dirk, the newer JDKs come with a HTML converter utility for using the plugin for applets. Take a look at http://java.sun.com/products/plugin/1.3/docs/htmlconv.html
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks Ilja. I'm currently working on picking this one apart based on The Java Plug-in 1.4 Developer Guide...
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Round 2a
    I found some more information in a series of articles at Sun called Java Plug-in 1.4 Developer Guide. Chapter 3 was particularly helpful.
    The bottom line would seem to be, the APPLET tag tells the browser to use its default Java applet support. So, for Java 1.1 Applets, we might expect this code to work:Take a look at JavaVersionRound02a that uses the APPLET tag and the following Java code compiled for Java 1.1:It should display a mostly blank applet (with a dimension of 500 by 500 pixels), that displays a single string stating the version of Java in use.
    If the applet were developed for Java 2 and newer versions of Internet Explorer and Netscape were used, use of the applet tag would seem to be fine if a new enough Java Plug-In is registered for use as the default Java support. If the user hasn't installed and specified a new enough verion of the Java Plug-In for use, or if the user is using Netscape 4 which doesn't seem to allow default Java Plug-In use specification, then a problem arises.
    Round 2b <Taking The Gloves Off>
    Further steps in this academic exploration would seem to be mostly frustrating, so let's cut to the chase and just use the HTML Converter tool provided by Sun. Detailed information on using the HTML Converter provided with SDK 1.4 can be found in the document More About HTML Converter and for information on using the Converter with SDK 1.3 take a look at the documents referenced by Ilja above.
    Running this html document:through the HTML Converter (allowing for any version of the Java Plugin-In at least as new as 1.4) produces this:Does it work? Take a look at JavaVersionRound02b and see that it does (hopefully).
    This HTML Converter Tool only provided options relative to version 1.4 of the Java Plug-In. I haven't fully tested these changes, but I do believe that the html document can be changed in two places to require only version 1.2 or newer. The two changed lines would be:Any questions or comments?
     
    Marilyn de Queiroz
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I can see JavaVersionRound02a 1.1.4 (using IE6.0 at the library), but with JavaVersionRound02b I see only a white screen, not even a gray box (no numbers and no scroll bar).

    Using NS6.2 JavaVersionRound02a gives me a gray box and 1.3.1_02, and JavaVersionRound02b gives me an identical screen.

    I'll check other browsers in a different location later.
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I can see JavaVersionRound02a 1.1.4 (using IE6.0 at the library), but with JavaVersionRound02b I see only a white screen, not even a gray box (no numbers and no scroll bar).
    Unfortunately, that's what happens when the security settings don't allow potentially dangerous scripts to run. I'm able to replicate your experience with IE, if I disable ActiveX controls and Plug-Ins. This is an unfortunate result as the browser settings do clearly allow Java applets to run.
    If you get back to the library (or are still there), could you test whether the Swing Applet referenced in my initial post works? It does not work in my testing when I set the ActiveX controls and Plug-Ins security settings to "Disable".

    Using NS6.2 JavaVersionRound02a gives me a gray box and 1.3.1_02, and JavaVersionRound02b gives me an identical screen.
    Your experience with JavaVersionRound02a must mean that NS6.2 is configured to use the 1.3.1_02 Java Plug-In by default. JavaVersionRound02b should require version 1.4 or newer, so I can't make sense of this result. Perhaps I'm not understanding the html document fully.
    [ June 09, 2002: Message edited by: Dirk Schreckmann ]
     
    Marilyn de Queiroz
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Now I'm home.
    IE5.5
    JavaVersion -> black background, browser default-color applet with 1.1.4 in the middle of the box

    NN 4.7 -> black page, browser default-color applet with 1.1.5 in the middle of the box

    IE5.5
    JavaVersionRound02a -> browser default-color page with 1.1.4 in the middle of the top of the page

    NN4.7 -> browser default-color page with 1.1.5 in the middle of the top of the page.

    IE5.5 JavaVersionRound02b -> grey page, nothing else.

    NN4.7 asks me to download plug-in 1.4
     
    Marilyn de Queiroz
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Can you see JavaVersionRound02c?
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Round02c
    IE6 with ActiveX controls and Plug-Ins disabled - white screen (nothing)
    IE6 with ActiveX controls and Plug-Ins enabled - 1.4.0_01
    N4.08 - 1.4.0_01
    [ June 09, 2002: Message edited by: Dirk Schreckmann ]
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Here's the html document that version 1.3 of the HTML Converter creates from the above "plain" use of the APPLET tag:Try out Round02d that uses this code and report any problems or questions that arise.
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Round2d Results
    IE6 with ActiveX controls and Plug-Ins disabled - white screen (nothing)
    IE6 with ActiveX controls and Plug-Ins enabled - 1.4.0_01
    N4.08 - 1.4.0_01
    [ June 09, 2002: Message edited by: Dirk Schreckmann ]
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I was working today at the local university. Nobody ever comes on Sundays, so I spent some time testing our Applet attempts on the computers in the computer lab.
    The results:
    Internet Explorer 6
    IE6 used by default Java 1.1.4 and had available version 1.3.1 of Sun's Java Plug-In.
    Round02a - 1.1.4
    Round02b - nothing
    Round02d - 1.3.1
    Round02c - prompt for plug-in download & installation - then 1.4.0
    Netscape 4.7
    N4.7 used by default Java 1.1.5 and had available version 1.3.1 of Sun's Java Plug-In.
    Round02a - 1.1.5
    Round02d - 1.3.1
    Round02b - prompt for plug-in download & installation - then 1.4.0_01
    Round02c - prompt for plug-in download & installation - then 1.4.0_01
    Conclusion
    The version that Marilyn has presented seems to be the best version so far. Increasing the security settings on these test computers, unfortunately resulted in blank screens with Rounds02b, 02c, and 02d.
    Just in case these test files ever get moved around, the contents of Round02c are:
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I missed something.
    The default template used by HTML Converter version 1.4 is called "Standard (IE & Navigator) for Windows & Solaris Only". The converted page allegedly works with IE and NN on Windows, and with Netscape on Unix.
    Another, potentially more universal template, called "Extended (Standard + All Browsers/Platforms)", is alleged to generate pages that work in any browser on any platform.
    With this "Extended" template, Round02a is converted into Round02e.
    It doesn't work. My installation of IE6 reports an unterminated string constant error at line 23, character 69 and displays the applet without using the Java 2 Plug-In (so 1.1.4 is displayed). N4.7 doesn't report any problems, but the applet it displays shows Java version 1.1.5 in use - so it also didn't like something in the code.
    Lines 23 through 29 read:and the 69th character is the newline character or perhaps a carriage return.
    I don't know JavaScript, but if this were Java, then I'd understand the problem. Let's try to solve the problem as if it were Java. I don't know how to concatenate strings in JavaScript, so the short answer is to just put the whole string in a single line. I'll save you the pain of scrolling left and right and just tell you that's what I did and the new document is available as Round02f.
    The good news is that it works on my installation of IE6 and N4.7 (on Windows XP Professional). The bad news is that if ActiveX controls and Plug-Ins aren't allowed with IE6, then nothing is displayed - it would be nice to then be able to tell the IE to just use default Java support.
    Do you have any questions or comments? How does it work on your configuration?
    [ June 10, 2002: Message edited by: Dirk Schreckmann ]
     
    Marilyn de Queiroz
    Sheriff
    Posts: 9109
    12
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    IE 5.5 results identical to your IE 6 results.
     
    Dirk Schreckmann
    Sheriff
    Posts: 7023
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I tested these various pages on a friend's computer running Windows XP with IE6.
    The results:
    02a - 1.1.4
    02b - nothing
    02c - prompts to install 1.4 plug-in
    02d - prompts to install 1.3 plug-in
    02e - 1.1.4 - which indicates failure
    02f - nothing
    [ June 14, 2002: Message edited by: Dirk Schreckmann ]
     
    Ranch Hand
    Posts: 1873
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    can anybody look at this post of mine here and tell me if there is a solution to my problem? i tried posting this on Applet forum, JavaScript forum but nobody even told me if we can solve my problem or not.
    my post
    i dont face problem with my applet's plugin and browsers to make them visible..but i am not able to do what i want (in NN6 browser). i can do it in IE as <object> tag has ID attribute...

    regards
    maulin.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic