[英]Can't start main class when classpath order changes
I am trying to start rascal with clair from the command line, however I do not understand why this happens:我试图从命令行用 clair 启动 rascal,但我不明白为什么会这样:
java -cp "rascal-0.18.0.jar;clair_0.1.0.202005281059.jar;org.eclipse.cdt.core_6.11.0.202003081657.jar" org.rascalmpl.shell.RascalShell
Version: 0.18.0
INFO: detected |lib://rascal| at |jar+file:///C:/ws/rascal-0.18.0.jar!/|
INFO: detected |lib://clair| at |jar+file:///C:/ws/clair_0.1.0.202005281059.jar!/|
rascal>
But when the order of the jars changes, it fails:但是当 jars 的顺序改变时,它失败了:
java -cp "clair_0.1.0.202005281059.jar;rascal-0.18.0.jar;org.eclipse.cdt.core_6.11.0.202003081657.jar" org.rascalmpl.shell.RascalShell
Version: 0.18.0
INFO: detected |lib://clair| at |jar+file:///C:/ws/clair_0.1.0.202005281059.jar!/|
INFO: detected |lib://rascal| at |jar+file:///C:/ws/rascal-0.18.0.jar!/|
main function should either have one argument of type list[str], or keyword parameters
Usage: java -jar ...
Is this normal behavior with classpaths?这是类路径的正常行为吗?
Note: The clair jar does not contain a org.rascalmpl.shell.RascalShell class.注意:clair jar 不包含 org.rascalmpl.shell.RascalShell class。
Update: Removing from META-INF/RASCAL.MF the line:更新:从 META-INF/RASCAL.MF 中删除以下行:
Main-Function: main
Main-Module: lang::cpp::IDE
resolves the problem, so it seems to be an issue with Rascal (and a rascal function) and not with Java (and a Java function).解决了问题,所以这似乎是 Rascal(和 rascal 函数)的问题,而不是 Java(和 Java 函数)的问题。
I think you have found two bugs in the REPL:我认为您在 REPL 中发现了两个错误:
Main-Function
definition which is intended for the IDE plugin, also in the terminal.第二个行为是我们尝试运行Main-Function
定义的错误,该定义适用于 IDE 插件,也在终端中。 I think the issue/bug is that we use the same configuration for command line as ide integration point, we might need to add a seperate tag for this.我认为问题/错误是我们使用与 ide 集成点相同的命令行配置,我们可能需要为此添加一个单独的标记。RascalShell's main function behaves differently if there are commandline parameters and differently depending on the first RASCAL.MF file it finds in the classpath.如果有命令行参数,RascalShell 的主要 function 行为会有所不同,并且会有所不同,具体取决于它在类路径中找到的第一个 RASCAL.MF 文件。
I suspect the latter is at work: the order of the classpath changes which RASCAL.MF file is found and therefore the REPL does not start but some module is being loaded and not found.我怀疑后者在起作用:类路径的顺序改变了找到的 RASCAL.MF 文件,因此 REPL 没有启动,但一些模块正在加载但找不到。 I'm not sure though, since I can't set a breakpoint from here;-)不过我不确定,因为我不能从这里设置断点;-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.