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

Wrong os.name property in Windows 10 when run in the compatibility mode

XMLWordPrintable

    • x86
    • windows_10

      FULL PRODUCT VERSION :
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 10

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Running on compatibility mode (for example, Windows 7)

      A DESCRIPTION OF THE PROBLEM :
      Try this below code in a number of Java version / vendor combinations in Windows 10 OS, after each of the 'java' executbale made compatible with Windows 7.


      C:\foo>cat OSN.java
      public class OSN {
        public static void main(String args[]) {
          System.out.println(System.getProperty("os.name"));
        }
      }

      C:\foo>java -version
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build pwa6480sr3-20160428_01(SR3))
      IBM J9 VM (build 2.8, JRE 1.8.0 Windows 7 amd64-64 Compressed References 20160427_301573 (JIT enabled, AOT enabled)
      J9VM - R28_Java8_SR3_20160427_1620_B301573
      JIT - tr.r14.java.green_20160329_114288
      GC - R28_Java8_SR3_20160427_1620_B301573_CMPRSS
      J9CL - 20160427_301573)
      JCL - 20160421_01 based on Oracle jdk8u91-b14

      C:\foo>java OSN
      Windows 7

      C:\foo>..\java7\bin\java -version
      java version "1.7.0_80"
      Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

      C:\foo>..\java7\bin\java OSN
      Windows 7

      C:\foo>..\java8\jdk1.8.0\bin\java -version
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

      C:\foo>..\java8\jdk1.8.0\bin\java OSN
      Windows 7

      C:\foo>..\java8_u51\bin\java -version
      java version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

      C:\foo>..\java8_u51\bin\java OSN
      Windows 7

      C:\foo>"C:\Program Files\Java\jre1.8.0_131\bin\java.exe" -version
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

      C:\foo>"C:\Program Files\Java\jre1.8.0_131\bin\java.exe" OSN
      Windows 10

      Oracle Java 8 version does not turn os.name property into Windows 7 when run in the compatibility mode

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile and run this code on Windows 10, running in compatibility mode
      public class OSN {
        public static void main(String args[]) {
          System.out.println(System.getProperty("os.name"));
        }
      }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Windows 7
      ACTUAL -
      Windows 10

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class OSN {
        public static void main(String args[]) {
          System.out.println(System.getProperty("os.name"));
        }
      }
      ---------- END SOURCE ----------

        1. OSN.java
          0.1 kB
          Pallavi Sonal

            rriggs Roger Riggs
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: