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

java --dry-run should not cause main class be initialized

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • None
    • b126
    • Verified

      public class Test {
         static {
             System.out.println("Hello from <clinit>");
         }
         public static void main(String[] args) {
             System.out.println("Hello from main()");
         }
      }

      ...when run with: "java -cp . Test", produces the following:

      Hello from <clinit>
      Hello from main()

      ...but when run with: "java --dry-run -cp . Test", it still produces the following:

      Hello from <clinit>

            mchung Mandy Chung (Inactive)
            mchung Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: