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

Cross compilation not as documented

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8u40
    • 7
    • docs

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      The javac technote here: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#crosscomp-example
      says that specifying " -source 1.6 " will produce javase6 compatible class files and specifying " -target 1.6 " is not required.

      But in practice this is not the case and omitting " -target 1.6 " will produce javase7 class files.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create ubiquitous HelloWorld.java
      2. Compile with: javac -source 1.6 HelloWorld.java
      3. Run with: /path/to/jre6/bin/java HelloWorld

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Prints " Hello, World! "
      ACTUAL -
      Exception about wrong class file vertion number.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            rgallard Raymond Gallardo
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: