[英]Order in which classLoader will load classes in this scenario
I added lombok
to my java project in eclipse
. 我在
eclipse
中将lombok
添加到我的java项目中。 It required me to add the last two lines in eclipse.ini
file as vmargs
. 它要求我将
eclipse.ini
文件中的最后两行添加为vmargs
。
-showlocation
-vm
/home/$USER/JavaSE8/jdk1.8/bin/java
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20150204-1316
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms500m
-Xmx2g
-Dorg.eclipse.swt.browser.XULRunnerPath=''
-javaagent:/home/$USER/eclipse/4.4-luna-SR2/lombok.jar
-Xbootclasspath/a:/home/$USER/eclipse/4.4-luna-SR2/lombok.jar
I have also added lombok.jar
in libraries
(Project -> Properties -> Libraries) and also moved lombok.jar
to the topmost level in Order and Export tab (Project -> Properties -> Order and Export) in eclipse and JRE System Library (rt.jar, resources.jar, etc.) all are below lombok.jar
. 我还在
libraries
添加了lombok.jar
(项目 - >属性 - >库),并将lombok.jar
移动到eclipse和JRE系统库中的Order and Export选项卡(Project - > Properties - > Order and Export)中的最顶层。 (rt.jar,resources.jar等)都在lombok.jar
。 I'm confused about the order in which lombok
main class will be loaded as : 我对
lombok
主类将被加载的顺序感到困惑:
When eclipse
is launched, the Bootstrap
classloader should load all JDK classes in directory of JRE. 启动
eclipse
, Bootstrap
类加载器应该加载JRE目录中的所有JDK类。 (But since I have moved lombok.jar
up in Order and Export, above JRE system libraries, will rt.jar be loaded after lombok.jar
. Mostly No? because bootstrap libraries should always be loaded first no matter WHAT !) (但是因为我已经将
lombok.jar
移动到Order和Export中,在JRE系统库之上,将在lombok.jar
之后加载rt.jar。大部分都没有?因为无论什么东西都应该首先加载bootstrap库!)
Since we also redefined the bootstrap classpath
using -XBootstrapClasspath option, lombok.jar will be loaded by Bootstrap Classloader
. 由于我们还使用-XBootstrapClasspath选项重新定义了
bootstrap classpath
,因此lstok.jar将由Bootstrap Classloader
Classloader Bootstrap Classloader
。
After that Extensions classloader
loads the classes in lib\\ext directory of the JRE. 之后,
Extensions classloader
加载Extensions classloader
加载JRE的lib \\ ext目录中的类。
Then System-Classpath classloader
loads all classes and jars specified by the CLASSPATH environment variable (Does this loading takes into account the Order and Export
order of libraries?) 然后
System-Classpath classloader
加载System-Classpath classloader
加载CLASSPATH环境变量指定的所有类和jar(此加载是否考虑了库的Order and Export
顺序?)
Please correct me if I'm wrongly interpreting things here as I'm just newbie trying to understand the ClassLoading maze. 如果我错误地解释这里的事情,请纠正我,因为我只是新手试图理解ClassLoading迷宫。
You often mention the "order and export". 你经常提到“订单和出口”。 I assume you mean the same named tab in the project classpath dialog.
我假设您的意思是项目类路径对话框中的相同命名选项卡。 As far as I know this concerns only the visibility of the projects library for other projects which depend on this project.
据我所知,这仅涉及项目库对依赖于该项目的其他项目的可见性。 It has nothing to do how eclipse itself is bootstrapped.
它与eclipse本身的自举方式无关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.