简体   繁体   English

java13 和 Eclipse 奇怪的行为

[英]java13 and Eclipse strange behaviour

I'm trying to use Java 13 with Eclipse on Linux.我正在尝试在 Linux 上使用 Java 13 和 Eclipse。 I'm trying to create a 'portable' java+eclipse folder, that can be moved between machines.我正在尝试创建一个可以在机器之间移动的“便携式”java+eclipse 文件夹。 I have downloaded and unzipped Java 13 from https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html I have downloaded and unzipped Java 13 from https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html

Eclipse from https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/S-4.13RC1-201908281800/eclipse-SDK-4.13RC1-linux-gtk-x86_64.tar.gz Eclipse from https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/S-4.13RC1-201908281800/eclipse-SDK-4.13RC1-linux-gtk-x86_64.tar.gz

and inside the eclipse market place I have installed all the parts of https://download.eclipse.org/eclipse/updates/4.13-P-builds在 eclipse 市场内,我已经安装了https://download.eclipse.org/eclipse/updates/4.13-P-builds

I have set the jdk to the jdk13 folder.我已将 jdk 设置为 jdk13 文件夹。 The result is that Eclipse can compile my Java13 code, but not run it.结果是 Eclipse 可以编译我的 Java13 代码,但不能运行它。 When I try to run I get当我尝试跑步时,我得到

[..]/EclipseJava13/jdk-13/bin/java: symbol lookup error: [..]/EclipseJava13/jdk-13/bin/java: undefined symbol: JLI_InitArgProcessing

I can compile and run Java13 from command line no problem using commands:我可以使用命令从命令行编译和运行 Java13 没有问题:

../../../jdk-13/bin/javac --release 13 --enable-preview main/Main.java
../../../jdk-13/bin/java --enable-preview main.Main

If I cut-paste the *.class generated by eclipse I can run them using command如果我剪切粘贴由 eclipse 生成的 *.class 我可以使用命令运行它们

../../../jdk-13/bin/java --enable-preview main.Main

no problem.没问题。 Thus Eclipse is recognizing Java 13 and is correctly compiling Java 13 code.因此 Eclipse 正在识别 Java 13 并正确编译 Java 13 代码。

But... when I try to run from inside Eclipse, I get that error.但是......当我尝试从 Eclipse 内部运行时,我得到了那个错误。 I'm not sure what to do next.我不确定下一步该怎么做。

Ok, I have discovered the issue.好的,我发现了这个问题。 Eclipse itself is a Java program. Eclipse 本身就是一个 Java 程序。 On my machine I also had Java8 eclipse was running using Java8.在我的机器上,我还有 Java8 eclipse 正在使用 Java8 运行。 Java8 was pre-loading a version of the library containing symbol JLI_InitArgProcessing in the environment. Java8 在环境中预加载了包含符号 JLI_InitArgProcessing 的库版本。 Thus when Java 13 was run in the same environment it was trying to reuse the cached version of such library.因此,当 Java 13 在同一环境中运行时,它试图重用此类库的缓存版本。 If I start eclipse using Java13, then there is no problem.如果我使用Java13启动eclipse,那就没有问题了。

You should not need to add --release 13 with " Java 13 Support for Eclipse 2019-09 "您不需要添加--release 13与“ Java 13 Support for Eclipse 2019-09

It refers toEclipse R-4.13-201909161045/ , which does have official Java support它指的是Eclipse R-4.13-201909161045/ ,确实有官方Java 支持

The release notably includes the following Java 13 features:该版本特别包括以下 Java 13 功能:

See " Wiki Java13/Examples ".请参阅“维基 Java13/示例”。

https://wiki.eclipse.org/images/9/9b/FileAddJ13.png

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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