Results 1 to 6 of 6
  1. #1
    CoderMan is offline Member
    Join Date
    Feb 2010
    Location
    Ross Lunar Capsule 2571
    Posts
    15
    Rep Power
    0

    Default Macintosh Applet Quirkiness

    Hi. I have this rather annoying situation in a work project. All my systems are Linux, so naturally I want to compile under Linux using javac. But for some mysterious reason, if I compile under Linux, the resultant Java applet bytecode will not work when viewed in a web browser on a MacOS X system. (While working just fine when viewed on a Windows or Linux system.)

    But if I take the same source code, and compile it using javac on a MacOS X system, the resultant Java applet byte code will work fine when viewed in a web browser on any OS.

    So, why is it that bytecode must be compiled on a MacOSX system in order to be compatible with an OSX system? Besides not making any sense, it is a real pain because development code and production code have to be built on separate systems.

    Many months ago I did some research into this problem, but I wasn't able to find any helpful explanations.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I don't do applets nor Mac coding, but I wonder: Do you compile at a compliance level of Java 1.5 or 1.6? I believe that mac supports 1.5 but not 1.6 (anyone -- please correct me if I'm wrong!).

  3. #3
    CoderMan is offline Member
    Join Date
    Feb 2010
    Location
    Ross Lunar Capsule 2571
    Posts
    15
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    I don't do applets nor Mac coding, but I wonder: Do you compile at a compliance level of Java 1.5 or 1.6? I believe that mac supports 1.5 but not 1.6 (anyone -- please correct me if I'm wrong!).
    You are correct, Mac systems (at least the ones at my workplace) only support 1.5. Unfortunately, this is not the problem. I did testing again today: the only way I can get the applets to display on a Mac is to compile them on a Mac, using the -source 5 switch. If I compile the same source code on a Linux box, the applet will not show up on the Macs, even with the -source 5 switch.

    Unfortunately, the Java console on the Mac systems doesn't provide any information as to why to applet won't display -- all I see is a little red "X" where the applet is supposed to be in the browser. I tested with Firefox and with Safari -- no noticeable difference.

    I also noticed during testing that the applet responds less reliable to mouse clicks when displayed on a Mac computer.

  4. #4
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Do you have an actual JDK installed on your Linux box? Many Linux distributions ship with gcj (Gnu Compiler for Java) as the Java dev and runtime environment. It's not necessarily a problem, but it's worth checking out whether you have a Sun JDK/JRE.

    -Gary-

  5. #5
    CoderMan is offline Member
    Join Date
    Feb 2010
    Location
    Ross Lunar Capsule 2571
    Posts
    15
    Rep Power
    0

    Default

    Quote Originally Posted by gcalvin View Post
    Do you have an actual JDK installed on your Linux box? Many Linux distributions ship with gcj (Gnu Compiler for Java) as the Java dev and runtime environment. It's not necessarily a problem, but it's worth checking out whether you have a Sun JDK/JRE.

    -Gary-
    As far as I can tell, the Sun JDK/JRE are the only ones installed on my system, and I can't locate gcj anywhere on my system.

    Java Code:
    choward@voltron /rcdp/production/www $ whereis javac
    javac: /usr/bin/javac /opt/sun-jdk-1.6.0.20/bin/javac
    choward@voltron /rcdp/production/www $ ls -l /usr/bin/javac 
    lrwxrwxrwx 1 root root 13 Apr 15 14:03 /usr/bin/javac -> run-java-tool
    choward@voltron /rcdp/production/www $ ls -l /usr/bin/run-java-tool 
    -rwxr-xr-x 1 root root 1536 Jan 13  2009 /usr/bin/run-java-tool
    choward@voltron /rcdp/production/www $ java -version    
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)
    choward@voltron /rcdp/production/www $ javac -version
    javac 1.6.0_20
    There doesn't seem to be a more specific javac switch. I am not sure how to find out exactly what "run-java-tool" is calling. Gentoo portage shows the sun Java JDK installed as I intended:

    Java Code:
    voltron public_html # emerge --search sun-jdk 
    Searching...    
    [ Results for search key : sun-jdk ]
    [ Applications found : 1 ]
    
    *  dev-java/sun-jdk
          Latest version available: 1.6.0.20
          Latest version installed: 1.6.0.20
          Size of files: 165,736 kB
          Homepage:      http://java.sun.com/javase/6/
          Description:   Sun's Java SE Development Kit
          License:       dlj-1.1

  6. #6
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Yeah, that sure looks like Sun Java. I have had some applet strangeness on my MacBook too, but nothing like complete failure to launch. More like controls that behave strangely.

    -Gary-

Similar Threads

  1. Replies: 2
    Last Post: 09-29-2009, 04:33 PM
  2. Calling another applet on click of button in one applet
    By niteshwar.bhardwaj in forum Java 2D
    Replies: 1
    Last Post: 02-19-2009, 01:54 PM
  3. need applet help !
    By fadiRU in forum Java Applets
    Replies: 2
    Last Post: 02-08-2009, 03:29 AM
  4. BFS using APPLET
    By bharanidharanit in forum Java Applets
    Replies: 3
    Last Post: 12-30-2008, 03:45 AM
  5. Replies: 4
    Last Post: 06-08-2007, 07:15 AM

Posting Permissions

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