当我尝试运行testNG案例时,intellij将在控制台中打印这些信息:
“C:\ Program Files(x86)\ Java \ jdk1.6.0_38 \ bin \ java”-ea -Xmx1024m -XX:PermSize = 256m -XX:MaxPermSize = 256m -Didea.launcher.port = 7539“ - Didea.launcher.bin.path = C:\ Program Files(x86)\ JetBrains \ IntelliJ IDEA Community Edition 13.1.4 \ bin“ -classpath”C:\ Program Files(x86)\ JetBrains \ IntelliJ IDEA Community Edition 13.1.4 \ lib \ idea_rt.jar; C:\ Program Files(x86)\ JetBrains \ IntelliJ IDEA Community Edition 13.1.4 \ lib \ util.jar“ -Dfile.encoding = GBK com.intellij.rt .execution.CommandLineWrapperC:\ Users \ xufei.xf \ AppData \ Local \ Temp \ classpath2884092874744737935.tmp com.intellij.rt.execution.application.AppMain org.testng.RemoteTestNGStarter -port 65182 -usedefaultlisteners false -socket65183 -temp C:\用户\ xufei.xf \应用程序数据\本地\ TEMP \ idea_testng4985883226383677033.tmp
如您所见,Intellij设置-classpath选项,当我调试时,我找到了代码
(URLClassLoader)ClassLoader.getSystemClassLoader();
无法加载其他jar(maven依赖jar ..)但只能加载 C:\ Program Files(x86)\ JetBrains \ IntelliJ IDEA Community Edition 13.1.4 \ lib \ idea_rt.jar; C:\ Program Files(x86)\ JetBrains \ IntelliJ IDEA Community Edition 13.1.4 \ lib \ util.jar
所以我想知道Intellij可能会改变类路径,所以类加载器无法在运行时加载我需要的类?
我也尝试在eclipse中运行代码,没关系。