英文:
how can I run Java code while i have JDK and JRE installed on windows?
问题
Sure, here's the translated content:
我是Java编程的新手,现在正在测试一个用于测试的HelloWorld代码。我在控制台文件夹中使用命令javac HelloWorld.java
,它会创建一个文件HelloWorld.class
。当我运行命令java HelloWorld
时,我得到以下错误:
> 错误:发生了JNI错误,请检查您的安装并重试
主线程中的异常"main" java.lang.UnsupportedClassVersionError: HelloWorld已由更新版本的Java Runtime编译(类文件版本58.0),而此版本的Java Runtime仅识别高达52.0的类文件版本...
我必须提到我已经安装了JDK 14.0.2和JRE(用于Minecraft和服务器 :))。
英文:
I am new in java programming and now i am testing a helloworld code to test. I use the command
javac HelloWorld.java
in the console folder it's create a file HelloWorld.class
. When i am running the command java HelloWorld
i get
> Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0 ...
I have to mention that i have JDK 14.0.2 installed and JRE ( for minecraft and server )
答案1
得分: 1
不要运行 java HelloWorld.Java,而是运行 java HelloWorld,即不带 .java 扩展名。
英文:
Don't run java HelloWorld.Java instead
Run java HelloWorld ie without .java extensions.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论