Skip to content

Conversation

@iuv
Copy link
Contributor

@iuv iuv commented Jul 12, 2021

What is the purpose of the change

Fix the problem of startup error when the JAVA_HOME path contains spaces under Linux/Unix/Mac system

Brief changelog

Finally, execute the command to add double quotation marks to deal with the situation that there are spaces in the full path of the JAVA command, and at the same time to configure "-Djava.ext.dirs" to independently define a variable to deal with the problem of spaces in the JAVA_HOME path

JAVA_OPT_EXT_FIX="-Djava.ext.dirs=\"${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext\""
.
.
.
nohup "$JAVA" "$JAVA_OPT_EXT_FIX" ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 &

Verifying this change

Before repair

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java  -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/jre/lib/ext:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/ext -Xloggc:/Users/ixx/Downloads/nacos/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/Users/ixx/Downloads/nacos/nacos/plugins/health,/Users/ixx/Downloads/nacos/nacos/plugins/cmdb -Dnacos.home=/Users/ixx/Downloads/nacos/nacos -jar /Users/ixx/Downloads/nacos/nacos/target/nacos-server.jar  --spring.config.additional-location=file:/Users/ixx/Downloads/nacos/nacos/conf/ --logging.config=/Users/ixx/Downloads/nacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nohup: /Library/Internet: No such file or directory

After repair

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -Djava.ext.dirs="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/jre/lib/ext:/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/ext"  -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xloggc:/Users/ixx/Downloads/nacos/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/Users/ixx/Downloads/nacos/nacos/plugins/health,/Users/ixx/Downloads/nacos/nacos/plugins/cmdb -Dnacos.home=/Users/ixx/Downloads/nacos/nacos -jar /Users/ixx/Downloads/nacos/nacos/target/nacos-server.jar  --spring.config.additional-location=file:/Users/ixx/Downloads/nacos/nacos/conf/ --logging.config=/Users/ixx/Downloads/nacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288

         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 2.0.2
,`--.'`|  ' :                       ,---.               Running in stand alone mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 8848
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 66084
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: http://192.168.1.8:8848/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'

@CLAassistant
Copy link

CLAassistant commented Jul 12, 2021

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement Category issues or prs related to enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants