运行报错问题求助
yuxiyuqi opened this issue · 3 comments
运行 java -Xms128m -Xmx1024m -jar huntly-server-0.1.0-SNAPSHOT.jar --server.port=5888
报错提示:
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/huntly/server/HuntlyServerApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:46)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
5888是我的自定义端口,在本例中,我的Java版本支持Java版本52.0及以下,但您的代码是用Java版本55.0编译的。我尝试使用ChatGPT和搜索引擎寻找解决方案,但是没有找到合适的方法。很抱歉,我是一个不懂后端的设计小白,希望你能指点帮助。
根据报错,你用的是 java8,安装个 java11 就可以了。
已经切换到Java11安装,目前终端里一直重复显示:
[huntly-server@0.1.0]dev 2023-03-08 19:43:22+0800 INFO [scheduling-1] com.huntly.server.service.TweetTrackService.trackNotSetReads(TweetTrackService.java:56) - trackNotSetReads success: 0
[huntly-server@0.1.0]dev 2023-03-08 19:43:32+0800 INFO [scheduling-1] com.huntly.server.service.TweetTrackService.trackNotSetReads(TweetTrackService.java:46) - trackNotSetReads: 0
[huntly-server@0.1.0]dev 2023-03-08 19:43:32+0800 INFO [scheduling-1] com.huntly.server.service.TweetTrackService.trackNotSetReads(TweetTrackService.java:56) - trackNotSetReads success: 0
编译的速度好像挺慢的,不知道安装是否有问题 :)
没问题了,这是日志,根据你用的系统把它设置成服务在后台运行就好了。