Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4413979

Properties.getProperty("os.name") failed to return OS Name in Applet

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.3.0
    • tools



      Name: yyT116575 Date: 02/09/2001


      ObjectName.getProperty("os.name") failed to return OS Name

      Source code as follows:

      /* <applet code=OSVersion height=100, width=300>
       * </applet>
       */

      import java.applet.Applet;
      import java.awt.*;
      import java.util.Properties;

      public class OSVersion extends Applet {
        //Construct fonts
        Font f1 = new Font("Arial", Font.BOLD, 14);

        public void init() {
        //resize the applet
          resize(250,50);
        }

        public void paint (Graphics g) {
          //Display the modhelpdesk background color in Applet
          Dimension myAppletDim = getSize();
          g.setColor(Color.magenta);
          g.fillRect(0,0,myAppletDim.width, myAppletDim.width);

          //Display the OS Name and Version
          Properties myProperties = System.getProperties();
          g.setFont(f1);
          g.setColor(Color.white);
          g.drawString("Operating System: " + myProperties.getProperty("os.name"), 10,20);
          g.drawString("OS Version: " + myProperties.getProperty("os.version"), 10, 35);
        }

      }

      The applet loads and doesn't display the OS Name or OS version.
      (Review ID: 116637)
      ======================================================================

            Unassigned Unassigned
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: