[GRADLE-2168] NoClassDefFoundError: "-Xdock:name=Gradle" in sub process Created: 14/Mar/12  Updated: 04/Jan/13  Resolved: 20/Mar/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-9
Fix Version/s: 1.0-rc-1

Type: Bug
Reporter: Yasuharu NAKANO Assignee: Unassigned
Resolution: Fixed Votes: 0


When invoking test task which has a invocation of outer java command, the following exception occurred.

$ gradle clean test
Exception in thread "main" java.lang.NoClassDefFoundError: "-Xdock:name=Gradle"
Caused by: java.lang.ClassNotFoundException: "-Xdock:name=Gradle"
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

This is caused by -Xdock:name and -Xdock:icon which are added at gradlew/unixStartScript. JAVA_OPTS affects sub processes which are invoked by build script.

I think that -Xdock:name and -Xdock:icon are only for Gradle on darwin, so they should be set to GRADLE_OPTS.

 if $darwin; then
-    JAVA_OPTS="$JAVA_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
     GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""

From another point of view, -Xdock:icon seems ineffective. If so, you can remove it.

Comment by Yasuharu NAKANO [ 14/Mar/12 ]

I've sent pull request.

Generated at Wed Jun 30 12:14:33 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.