简体   繁体   English

将JDK / JRE路径传递到Grails命令行执行

[英]Pass JDK/JRE path into Grails command line execution

Is there a way to pass a java/bin path name into grails on the command line, rather then having it always use what is in JAVA_HOME ? 有没有一种方法可以在命令行中将java / bin路径名传递到grails中,而不是始终使用JAVA_HOME I have an instance where I share a build machine and need a 64-bit JDK, but the other group still needs to keep using the 32-bit JDK. 我有一个实例,其中我共享一台构建机,并且需要一个64位JDK,但是另一个小组仍然需要继续使用32位JDK。

-------Solution------------- - - - -解 - - - - - - -

SET JAVA_HOME=C:\\...

SET PATH=%JAVA_HOME%\\bin;%PATH%

Its crucial to place %JAVA_HOME% before the rest of the path, as windows will use the first path that contains the java executable. %JAVA_HOME%放在路径的其余部分之前非常重要,因为Windows将使用包含Java可执行文件的第一个路径。

How about setting JAVA_HOME for the current console/cmd before calling the Grails command? 在调用Grails命令之前为当前控制台/ cmd设置JAVA_HOME怎么样?

set JAVA_HOME=path...
grails...

Setting the variable without exporting that will effect only the current console. 设置变量而不导出将仅影响当前控制台。

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

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