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

Improve error message from shebang launcher for --enable-preview script

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • tools
    • None
    • Cause Known
    • generic
    • generic

      shebang script:

      $ cat Hello
      #!/usr/bin/env java --enable-preview

      void main() {
         println("hello");
      }

      $ chmod 755 Hello

      $ ./Hello
      Error: Could not find or load main class ..Hello
      Caused by: java.lang.ClassNotFoundException: //Hello

      Per JEP 330

      "The --source option must also be used to specify the source version of the source code when the --enable-preview option is used."

      But, the error message above is misleading. The error message may mention about --source option requirement.

            Unassigned Unassigned
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: