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

java source launcher from a minimal jdk image containing jdk.compiler fails with --enable-preview option

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 18, 19
    • Fix Version/s: 19
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b26
    • CPU:
      generic
    • OS:
      generic

      Description

      $ jlink --add-modules jdk.compiler --output comp_only
      $ cd comp_only/bin

      $ cat Main.java
      class Main {
         public static void main(String[] args) {
           System.out.println("hello world");
         }
      }

      ./java --enable-preview --source 18 Main.java
      Exception in thread "main" java.lang.IllegalArgumentException: error: release version 18 not supported
      at jdk.compiler/com.sun.tools.javac.main.Arguments.reportDiag(Arguments.java:889)
      at jdk.compiler/com.sun.tools.javac.main.Arguments.handleReleaseOptions(Arguments.java:311)
      at jdk.compiler/com.sun.tools.javac.main.Arguments.processArgs(Arguments.java:350)
      at jdk.compiler/com.sun.tools.javac.main.Arguments.init(Arguments.java:246)
      at jdk.compiler/com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:191)
      at jdk.compiler/com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:119)
      at jdk.compiler/com.sun.tools.javac.launcher.Main.compile(Main.java:383)
      at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:189)
      at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132)


      But separate compilation and run works with --enable-preview option.

      $ ./javac --enable-preview --source=18 Main.java
      $ ./java --enable-preview Main
      hello world

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              asotona Adam Sotona
              Reporter:
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: