Harmony
  1. Harmony
  2. HARMONY-3251

[jdktools][samsa] jdk\bin\java without extension throws NoClassDefFoundError

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: JDK
    • Labels:
      None
    • Environment:
      Windows/ia32, harmony-jdk-r533073
    • Patch Info:
      Patch Available

      Description

      Java launcher from jdktools module fails on Windows if started without .exe extension. I've used HDK build (r512155) created with federated build.

      > jdk\bin\java.exe -version
      Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
      java version "1.5.0"
      pre-alpha : not complete or compatible
      svn = r512155, (Feb 27 2007), Windows/ia32/msvc 1310, release build
      http://incubator.apache.org/harmony

      > jdk\bin\java -version
      Uncaught exception in main:
      java.lang.NoClassDefFoundError: org/apache/harmony/tools/java/EXE/Main
      Caused by: java.lang.ClassNotFoundException: org.apache.harmony.tools.java.EXE.Main
      at java.net.URLClassLoader.findClass(URLClassLoader.java:623)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:534)
      at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:920)
      at java.lang.ClassLoader.loadClass(ClassLoader.java)
      FAILED to invoke JVM.

      Launcher from jdk/jre directory works fine in both cases:

      > jdk\jre\bin\java.exe -version
      Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
      java version "1.5.0"
      pre-alpha : not complete or compatible
      svn = r512155, (Feb 27 2007), Windows/ia32/msvc 1310, release build
      http://incubator.apache.org/harmony

      > jdk\jre\bin\java -version
      Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
      java version "1.5.0"
      pre-alpha : not complete or compatible
      svn = r512155, (Feb 27 2007), Windows/ia32/msvc 1310, release build
      http://incubator.apache.org/harmony

        Activity

        Hide
        Ivan Popov added a comment -

        This problem relates to jdktools SAMSA module, which provides jdk/bin/java[.exe] wrapper for java launcher.
        Changing module name in summary. It's still reproduced with harmony-jdk-r533073.

        Show
        Ivan Popov added a comment - This problem relates to jdktools SAMSA module, which provides jdk/bin/java [.exe] wrapper for java launcher. Changing module name in summary. It's still reproduced with harmony-jdk-r533073.
        Hide
        Elena Sayapina added a comment -

        Similar issue is reproduced for javac on harmony-hdk-r544707, harmony-jdk-r544707.

        'javac -help' output:
        Uncaught exception in main:
        java.lang.NoClassDefFoundError: org/apache/harmony/tools/javac/EXE/Main
        Caused by: java.lang.ClassNotFoundException: org.apache.harmony.tools.javac.EXE.Main
        at java.net.URLClassLoader.findClass(URLClassLoader.java:895)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:574)
        at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:962)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
        FAILED to invoke JVM.

        'javac.exe -help' output is ok:

        Eclipse Java Compiler 0.755, 3.3.0 milestone-7
        Copyright IBM Corp 2000, 2007. All rights reserved.

        Usage: <options> <source files | directories>
        ...

        Show
        Elena Sayapina added a comment - Similar issue is reproduced for javac on harmony-hdk-r544707, harmony-jdk-r544707. 'javac -help' output: Uncaught exception in main: java.lang.NoClassDefFoundError: org/apache/harmony/tools/javac/EXE/Main Caused by: java.lang.ClassNotFoundException: org.apache.harmony.tools.javac.EXE.Main at java.net.URLClassLoader.findClass(URLClassLoader.java:895) at java.lang.ClassLoader.loadClass(ClassLoader.java:574) at java.lang.ClassLoader$SystemClassLoader.loadClass(ClassLoader.java:962) at java.lang.ClassLoader.loadClass(ClassLoader.java:319) FAILED to invoke JVM. 'javac.exe -help' output is ok: Eclipse Java Compiler 0.755, 3.3.0 milestone-7 Copyright IBM Corp 2000, 2007. All rights reserved. Usage: <options> <source files | directories> ...
        Hide
        Ivan Popov added a comment -

        Samsa wrapper checks for ".exe" extension of the started tools. However, if tool is started without extension Windows adds ".EXE" extension in upper case, which is not recognized by the wrapper. This lead to the described problem.

        I fixed samsa wrapper to convert tool name to lower case before checking for extension, this resolves any possible problem with case-insensitive file names on Windows. With attached patch both 'java' and 'javac' wrappers are successfully launched with and without extension:

        > jdk\bin\java -version
        Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
        java version "1.5.0"
        pre-alpha : not complete or compatible
        svn = r548946, (Jun 20 2007), Windows/ia32/msvc 1310, debug build
        http://harmony.apache.org

        > jdk\bin\java.exe -version
        Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
        java version "1.5.0"
        pre-alpha : not complete or compatible
        svn = r548946, (Jun 20 2007), Windows/ia32/msvc 1310, debug build
        http://harmony.apache.org

        > jdk\bin\javac -version
        Eclipse Java Compiler 0.755, 3.3.0 milestone-7, Copyright IBM Corp 2000, 2007. All rights reserved.

        > jdk\bin\javac.exe -version
        Eclipse Java Compiler 0.755, 3.3.0 milestone-7, Copyright IBM Corp 2000, 2007. All rights reserved.

        Show
        Ivan Popov added a comment - Samsa wrapper checks for ".exe" extension of the started tools. However, if tool is started without extension Windows adds ".EXE" extension in upper case, which is not recognized by the wrapper. This lead to the described problem. I fixed samsa wrapper to convert tool name to lower case before checking for extension, this resolves any possible problem with case-insensitive file names on Windows. With attached patch both 'java' and 'javac' wrappers are successfully launched with and without extension: > jdk\bin\java -version Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. java version "1.5.0" pre-alpha : not complete or compatible svn = r548946, (Jun 20 2007), Windows/ia32/msvc 1310, debug build http://harmony.apache.org > jdk\bin\java.exe -version Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. java version "1.5.0" pre-alpha : not complete or compatible svn = r548946, (Jun 20 2007), Windows/ia32/msvc 1310, debug build http://harmony.apache.org > jdk\bin\javac -version Eclipse Java Compiler 0.755, 3.3.0 milestone-7, Copyright IBM Corp 2000, 2007. All rights reserved. > jdk\bin\javac.exe -version Eclipse Java Compiler 0.755, 3.3.0 milestone-7, Copyright IBM Corp 2000, 2007. All rights reserved.
        Hide
        Gregory Shimansky added a comment -

        Patch applied at 549149. Please check that the bug is fixed for you.

        Show
        Gregory Shimansky added a comment - Patch applied at 549149. Please check that the bug is fixed for you.
        Hide
        Ivan Popov added a comment -

        Thanks, Gregory.
        Verified in harmony-jdk-r549380, closing this issue.

        Show
        Ivan Popov added a comment - Thanks, Gregory. Verified in harmony-jdk-r549380, closing this issue.

          People

          • Assignee:
            Gregory Shimansky
            Reporter:
            Ivan Popov
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development