简体   繁体   中英

Error Running Java Application OSX

I am currently working on a Java game for OSX (and possibly Windows in the future) - I decided to export a Pre-Alpha / Alpha test of the game - to see if the engine was working properly outside of Eclipse. When I tried to run the application it quit almost instantly, throwing the following errors (in Console):

14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: [JavaAppLauncher Error] CallStaticVoidMethod() threw an exception 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: Exception in thread "main" 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: java.lang.UnsupportedClassVersionError: ten/plus/Game : Unsupported major.minor version 52.0 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: at java.lang.ClassLoader.defineClass1(Native Method) 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: at java.lang.ClassLoader.defineClass(ClassLoader.java:621) 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) 14-07-29 8:57:02.190 AM [0x0-0x1c21c2].10Plus: at java.net.URLClassLoader.access$000(URLClassLoader.java:58) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at java.net.URLClassLoader$1.run(URLClassLoader.java:197) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at java.security.AccessController.doPrivileged(Native Method) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at java.lang.Class.forName0(Native Method) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at java.lang.Class.forName(Class.java:249) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at apple.launcher.LaunchRunner.loadMainMethod(LaunchRunner.java:56) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at apple.launcher.LaunchRunner.run(LaunchRunner.java:112) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:51) 14-07-29 8:57:02.191 AM [0x0-0x1c21c2].10Plus: at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52) 14-07-29 8:57:02.220 AM com.apple.launchd.peruser.501: ([0x0-0x1c21c2].10Plus[3659]) Exited with code: 1

I know the code will throw a few IOExceptions - mainly due to image loading but it's all surrounded by try/catch and doesn't break the application when I remove the image files and run it in Eclipse.

Some notes about the application: It runs in fullscreen at the native resolution of the device - in my case 1680 x 1050 - but it doesn't act like a normal fullscreen application. For example: In most fullscreen applications if you move your mouse to the top of the screen and wit a second or two the apple menu bar comes down (with the time, etc...) but not with this. I'm not sure if this has to be coded specifically but it's not a feature I really need. I use the thread but it is not called 'main' - which makes me wonder about: Exception in Thread "main" The application should run in 1.6+ as that's the version I chose when exporting from Eclipse. Finally I use both AWT and SWING. AWT for graphics, KeyListener etc... and SWING for window handling.

Some notes about my computer software / hardware: I am running OSX 10.7.5 on a MacBook Pro 15 inch - early 2011 - as I said earlier my resolution is 1680x1050. According to Java Preferences I am running Java 8 Update 11, but according to Terminal I am running Java 6 Update 65 - both SE. (When I open Minecraft I get this towards the end of the launcher's boot [09:48:29 INFO]: System.getProperty('java.version') == '1.6.0_65' )

The last working export I have is my final export from Eclipse Kepler - I believe it's 1.4.3. That version had no IO whatsoever and ran in a 1200x875 window.

This is my first export from Luna - 1.4.4 if I'm correct.

I will try exporting the application in different versions of Java with both Kepler and Luna - in case the Luna exporter or Java version is the problem.

Thanks in advance!

PLEASE NOTE: I am beginner/intermediate in Java so please excuse me if I made some obvious mistake somewhere.

如果您已在Java版本X上编译了代码,则尝试在Java版本小于X的情况下运行程序。要运行该程序的版本应为> =X。因此,请始终尝试在最低版本的Java上编译程序。预期由用户使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM