简体   繁体   English

Eclipse Kepler(SR2)插件中jfxrt.jar的用法

[英]Usage of jfxrt.jar in Eclipse Kepler (SR2) Plugin

i'm, playing with an Eclipse 4 Application and Java 8, currently in Eclipse Kepler SR2. 我正在使用Eclipse Kepler SR2中的Eclipse 4 Application和Java 8。 There are various pitfalls which i don't understand, therefore i'm looking for your help: 我不了解各种陷阱,因此正在寻找您的帮助:

When i create a new plug-in in Java 8 (JDK) environment, the jfxrt.jar is listed in the JRE System Libraries in my project. 当我在Java 8(JDK)环境中创建新的插件时,jfxrt.jar列在我项目的JRE系统库中。

When i try to access a jfxrt class, i'll get an error (Discouraged Access). 当我尝试访问jfxrt类时,会收到错误消息(禁止访问)。 I tried to solve the error adjusting the build path by creating an Access Rule (* / ) to my JRE System Library. 我试图通过创建对JRE系统库的访问规则(* / )来解决调整构建路径的错误。 Sometimes it worked, somestimes i had to adjust the Compiler Settings for Discouraged Access to warning too. 有时它可以工作,有时我也必须将“禁止访问的编译器设置”调整为警告。

Afterwards, i could access the classes and compile them, but when i try to run (debug), the classes are still NOT visible to the plugin: 之后,我可以访问这些类并进行编译,但是当我尝试运行(调试)时,这些类仍然对插件不可见:

java.version=1.8.0
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product de.fsch.ibot.app.product -clearPersistedState
Command-line arguments:  ... -consoleLog -clearPersistedState

!ENTRY org.eclipse.osgi 4 0 2014-04-03 09:15:12.790
!MESSAGE Application error
!STACK 1
.
.
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

Any suggestions for me ? 有什么建议吗?

  1. restricted access - yes the reason is that JavaFX is on the extension classpath hence it is treated as an implementation detail of the VM by Eclipse 限制访问-是的,原因是JavaFX在扩展类路径上,因此被Eclipse视为VM的实现细节
  2. Runtime problem is because JavaFX packages ARE NOT part of any EE hence you can not find them in an OSGi-Env 运行时问题是因为JavaFX软件包不是任何EE的一部分,因此您无法在OSGi-Env中找到它们
  3. It does not make sense to use launch a JavaFX-Application inside an SWT-IDE plugin there you use an FXCanvas which will lead to your next problem because this is not on ANY classpath at all because it depends on SWT (you find it in your jre/lib/jfxswt.jar) 在SWT-IDE插件中使用启动JavaFX-Application毫无意义,因为您使用FXCanvas会导致下一个问题,因为这根本不依赖于任何类路径,因为它依赖于SWT(您可以在JRE / LIB / jfxswt.jar)

My suggestion is: Do yourself some a favor and install e(fx)clipse eg you can get an all in one download from http://efxclipse.bestsolution.at/install.html or use the update-site from http://www.efxclipse.org/install.html and follow https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2 if you want to go pure fx (no swt involved) then https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial3 and https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial4 are probably interesting to you 我的建议是:帮个忙,安装e(fx)clipse,例如,您可以从http://efxclipse.bestsolution.at/install.html进行一次完整下载,也可以使用http://的更新站点www.efxclipse.org/install.html并遵循https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial2如果您想使用纯fx(不涉及swt), 请https://wiki.eclipse.org/Efxclipse / Tutorials / Tutorial3https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial4可能对您很有趣

For the restricted access, do this: Go to project properties, java build path, libraries. 对于受限访问,请执行以下操作:转到项目属性,java构建路径,库。

  • Remove the "JRE System Library [java8]" thing 删除 “ JRE系统库[java8]”
  • .. and then add it again using "Add Library"-button -> JRE System Library -> Workspace default (if that is set to Java 8 on your workspace, if not, pick another option here). ..,然后使用“添加库”-> JRE系统库->工作区默认值再次添加它 (如果在工作区中将其设置为Java 8,否则请在此处选择其他选项)。

Got this from this SO answer . 这个SO答案中得到了这个。

Annoyingly, this worked for me! 烦人的,这对我有用!

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

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