通过命令行调用时,SpringTools Suite中缺少tools.jar [英] Missing tools.jar in SpringTools Suite when invoking via command line

查看:370
本文介绍了通过命令行调用时,SpringTools Suite中缺少tools.jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在看到以下屏幕:

通过脚本启动STS时:

upon STS startup via script:

start /B C:\"Program Files"\SpringTools4\sts-4.5.0.RELEASE\SpringToolSuite4.exe -data %~dp0 -clean -showlocation -vmC:\Java\jdk1.8.0_144\bin\java.exe -vmargs -Xmx1024m -XX:MaxPermSize=256m -vmargs -javaagent:lombok.jar

这是我的SpringToolSuite4.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1100.v20190907-0426
-product
org.springframework.boot.ide.branding.sts4
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-javaagent:C:\Program Files\SpringTools4\sts-4.5.0.RELEASE\lombok.jar

JAVA_HOME环境变量已定义:

根据Eclipse文档:

According to Eclipse documentation:

-vm(可执行文件,主要)

当传递给Eclipse可执行文件时,此选项用于查找要用于运行的Java VM 蚀.它应该是适当的完整文件系统路径: Java jre/bin目录,Java可执行文件,Java共享库(jvm.dll 或libjvm.so)或Java VM执行环境描述文件. 如果未指定,则Eclipse可执行文件使用搜索算法来 找到合适的虚拟机.无论如何,可执行文件都会通过 使用-vm参数的Java Main使用的实际VM的路径.爪哇 然后Main将这个值存储在eclipse.vm中.

when passed to the Eclipse executable, this option is used to locate the Java VM to use to run Eclipse. It should be the full file system path to an appropriate: Java jre/bin directory, Java Executable, Java shared library (jvm.dll or libjvm.so), or a Java VM Execution Environment description file. If not specified, the Eclipse executable uses a search algorithm to locate a suitable VM. In any event, the executable then passes the path to the actual VM used to Java Main using the -vm argument. Java Main then stores this value in eclipse.vm.

我检查了的可能指针,并尝试了配置,即:

I checked this for possible pointers and tried different variations of configurations, i.e.:

  • 从其.exe文件而不是从上面的脚本启动STS,然后指定工作区
  • -vmargs
  • 之前将-vm选项放入.ini文件
  • -vm指向包含java.exe的文件夹,而不是该特定文件
  • 指向javaw.exe而不是java.exe
  • 具有-vm指向JRE目录,而不指向JDK目录.
  • start STS from its .exe file and not from the above script and then specifying the workspace
  • putting -vm option into the .ini file before the -vmargs
  • pointing the -vm to the folder containing the java.exe instead of to that specific file
  • pointing to the javaw.exe instead of java.exe
  • having the -vm point to a JRE directory and not to a JDK one.
  • etc.

相同的错误仍然存​​在.

Same error persists.

看起来有些东西将STS重定向到C:\Program Files\Java\jre1.8.0_191而不是C:\Java\jdk1.8.0_144\binC:\Java\jdk1.8.0_144\jre\bin指向的位置.

Looks like something redirects STS to look inside C:\Program Files\Java\jre1.8.0_191 instead of C:\Java\jdk1.8.0_144\bin or C:\Java\jdk1.8.0_144\jre\bin where I'm pointing it to.

这可能是什么问题?

谢谢.

更新:

按照马丁的建议,进行了以下修改:

As Martin suggested, the following modification:

如果通过双击STS可执行文件来调用,则会导致打开2个STS窗口:一个常规的STS窗口(现在没有最初丢失的tools.jar提示)加上以下窗口:

if invoked by double-clicking the STS executable, results in opening 2 STS windows: a regular STS one (now without the initial missing tools.jar prompt) plus this one:

但是,当像以前一样通过命令行从脚本运行时,无法完全打开STS:

however, when run via script from the command line, as before, fails to open STS altogether:

最终解决方案:

如Martin在其评论中正确指出的那样,上述脚本存在多个问题:

As correctly pointed out by Martin in his comment, there are several issues with the above script:

  • -vm后面需要一个空格,并指向JDK的路径
  • 重复的-vmargs是引起最初错误行为的罪魁祸首
  • 指向javaw.exe而不是java.exe有助于隐藏第二个窗口.
  • 在Java 8中不再需要
  • -XX:MaxPermSize=256m.
  • -vm requires a space after it and the path to the JDK
  • duplicated -vmargs was the culprit causing the initial erroneous behavior
  • pointing to the javaw.exe instead of java.exe helps to hid the second window.
  • -XX:MaxPermSize=256m is no longer necessary under Java 8.

考虑到上述情况,这就是现在正在工作的内容:

With the above in mind, here is what's working now:

1)SpringToolSuite4.ini可以保持不变,不需要(尽管有可能并且可以正常工作)按照我先前的更新中的指示将路径添加到JDK:

1) The SpringToolSuite4.ini can stay intact, there's no need (although it's possible and working) to add the path to JDK there as pointed in my previous update:

  -startup
    plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar
    --launcher.library
    plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1100.v20190907-0426
    -product
    org.springframework.boot.ide.branding.sts4
    --launcher.defaultAction
    openFile
    -vmargs
    -Dosgi.requiredJavaVersion=1.8
    -Xms256m
    -Xmx1024m
    -XX:+UseG1GC
    -XX:+UseStringDeduplication
    --add-modules=ALL-SYSTEM
    -javaagent:C:\Program Files\SpringTools4\sts-4.5.0.RELEASE\lombok.jar

2)现在可以通过以下方式(在Windows上)成功调用STS:

2) The STS can now be successfully invoked via the following (on Windows):

start /B C:\"Program Files"\SpringTools4\sts-4.5.0.RELEASE\SpringToolSuite4.exe -data %~dp0 -clean -showlocation -vm C:\Java\jdk1.8.0_144\bin\java.exe -vmargs -Xmx1024m  

推荐答案

-vm arg添加到.ini文件中应该可以,但是您需要小心地将其放入该文件中的正确位置. -vm必须是该文件中的第一行,其后是指向JDK的Java可执行文件的附加字符.然后,第三行应继续使用.ini文件中的-startup部分.

Adding the -vm arg to the .ini file should work, but you need to carefully put that into the right place inside of that file. -vm has to be the first line in that file, followed by an additional like pointing to the java executable of the JDK. Then the third line should proceed with the -startup part that you have in your .ini file.

这篇关于通过命令行调用时,SpringTools Suite中缺少tools.jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆