weixin_39980841
weixin_39980841
2020-12-31 07:24

“Could not find or load main class field.launch.Launcher” Error on OS X

On OS X using 1.7, I get this when attempting to run field:

 bash
$ ./Contents/MacOS/field_mac64.sh
/Volumes/UserDrive/Users/slippyd/Development/uncat/Field/Field.app/Contents/MacOS/..
using built-in 1.7
Error: Could not find or load main class field.launch.Launcher

And after switching to 1.6, I get this:

 bash
$ ./Contents/MacOS/field_mac64.sh -field.scratch nameOfFileToOpen.field
/Volumes/UserDrive/Users/slippyd/Development/uncat/Field/Field.app/Contents/MacOS/..
using 1.6
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: field/launch/Launcher
Caused by: java.lang.ClassNotFoundException: field.launch.Launcher
    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)

Which looks to me like the same issue.

该提问来源于开源项目:OpenEndedGroup/Field

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

15条回答

  • weixin_39759918 weixin_39759918 4月前

    Can you confirm that Field built correctly on your machine?

    On Mon, May 27, 2013 at 7:47 AM, Slipp D. Thompson <notifications.com

    wrote:

    On OS X using 1.7, I get this when attempting to run field:

    $ ./Contents/MacOS/field_mac64.sh /Volumes/UserDrive/Users/slippyd/Development/uncat/Field/Field.app/Contents/MacOS/.. using built-in 1.7 Error: Could not find or load main class field.launch.Launcher

    And after switching to 1.6, I get this:

    $ ./Contents/MacOS/field_mac64.sh -field.scratch nameOfFileToOpen.field /Volumes/UserDrive/Users/slippyd/Development/uncat/Field/Field.app/Contents/MacOS/.. using 1.6 Exception in thread "Thread-1" java.lang.NoClassDefFoundError: field/launch/Launcher Caused by: java.lang.ClassNotFoundException: field.launch.Launcher 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)

    Which looks to me like the same issue.

    — Reply to this email directly or view it on GitHubhttps://github.com/OpenEndedGroup/Field/issues/34 .

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    Built? Oh… hmm. I guess I assumed that was the type of thing necessary only for those developing on field, and that just running the .app wouldn't necessitate that.

    I'll try that now.

    点赞 评论 复制链接分享
  • weixin_39759918 weixin_39759918 4月前

    If you checked out the source code from GitHub, you need to build Field first before you can run it.

    On Mon, May 27, 2013 at 8:37 AM, Slipp D. Thompson <notifications.com

    wrote:

    Built? Oh… hmm. I guess I assumed that was the type of thing necessary only for those developing on field, and that just running the .app wouldn't necessitate that.

    I'll try that now.

    — Reply to this email directly or view it on GitHubhttps://github.com/OpenEndedGroup/Field/issues/34#issuecomment-18499019 .

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    Makes sense.

    Side-note: The rename-to-.app thing is weird. I guess because a .app existing that is incomplete — that won't run nor pop a dialog telling the user what one needs to do — is kind of… unintuitive.

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    After a successful build, I'm getting different errors.

    1.7:

     bash
    $ MacOS/field_mac64.sh 
    /Volumes/UserDrive/Users/slippyd/Development/Tools/Field/Field.app/Contents/MacOS/..
    using built-in 1.7
    MacOS/field_mac64.sh: line 18: /Volumes/UserDrive/Users/slippyd/Development/Tools/Field/Field.app/Contents/MacOS/../Plugins/1.7.0.jdk//Contents/Home/bin/java: No such file or directory
    

    1.6:

     bash
    $ MacOS/field_mac64.sh 
    /Volumes/UserDrive/Users/slippyd/Development/Tools/Field/Field.app/Contents/MacOS/..
    using 1.6
    Exception in thread "Thread-1" java.lang.UnsupportedClassVersionError: field/launch/Launcher : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        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)
    
    点赞 评论 复制链接分享
  • weixin_39759918 weixin_39759918 4月前

    On Mon, May 27, 2013 at 8:57 AM, Slipp D. Thompson <notifications.com

    wrote:

    After a successful build, I'm getting different errors.

    1.7:

    $ MacOS/field_mac64.sh /Volumes/UserDrive/Users/slippyd/Development/Tools/Field/Field.app/Contents/MacOS/.. using built-in 1.7 MacOS/field_mac64.sh: line 18: /Volumes/UserDrive/Users/slippyd/Development/Tools/Field/Field.app/Contents/MacOS/../Plugins/1.7.0.jdk//Contents/Home/bin/java: No such file or directory

    Where is your 1.7.0 jdk installed? Edit field_mac64.sh to pick it up.

    1.6:

    $ MacOS/field_mac64.sh /Volumes/UserDrive/Users/slippyd/Development/Tools/Field/Field.app/Contents/MacOS/.. using 1.6 Exception in thread "Thread-1" java.lang.UnsupportedClassVersionError: field/launch/Launcher : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

    
    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)
    

    — Reply to this email directly or view it on GitHubhttps://github.com/OpenEndedGroup/Field/issues/34#issuecomment-18499854 .

    You built it with a 1.7 VM and are running it in 1.6.

    Marc

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    I did, but then after switching to 1.6 I rebuilt before running it. It didn't seem to do much though.

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    Ran an ant clean followed by ant (with the use16 default set). Ran field_mac64.sh again, same error as above.

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    Is there anything else I should try?

    点赞 评论 复制链接分享
  • weixin_39759918 weixin_39759918 4月前

    Fixing the launch script to point to your jvm 1.7 ?

    On Mon, May 27, 2013 at 10:24 AM, Slipp D. Thompson < notifications.com> wrote:

    Is there anything else I should try?

    — Reply to this email directly or view it on GitHubhttps://github.com/OpenEndedGroup/Field/issues/34#issuecomment-18503668 .

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    Sure. This means I should go download and install the OpenJDK 1.7 VM, correct? I really don't know much about Java.

    点赞 评论 复制链接分享
  • weixin_39759918 weixin_39759918 4月前

    I was assuming you already had one installed, because it looks like you managed to build Field using a 1.7 javac (hence the incorrect class file version).

    Marc

    On Mon, May 27, 2013 at 11:03 AM, Slipp D. Thompson < notifications.com> wrote:

    Sure. This means I should go download and install the OpenJDK 1.7 VM, correct? I really don't know much about Java.

    — Reply to this email directly or view it on GitHubhttps://github.com/OpenEndedGroup/Field/issues/34#issuecomment-18505211 .

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    java -version gives me:

    
    java version "1.7.0_17"
    Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
    Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
    

    and which java gives me:

    
    /usr/bin/java
    

    So yeah, I guess I do.

    It looks to me like it's the system Java, but maybe Java uses a single executable to switch between versions (for all I know). And I'm not sure how it would've gotten there, other than a system update. Or maybe some other GUI tool I installed (e.g. Eclipse, Xamarin Studio, etc.). I don't know these things.

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    Is this all a futile exercise, BTW? Is there a pre-built OS X binary that I should be using instead? I really just want to try this thing out.

    点赞 评论 复制链接分享
  • weixin_39980841 weixin_39980841 4月前

    Nevermind, I found it. I'm good here.

    点赞 评论 复制链接分享

相关推荐