i've the following problem, these is my shell script:
#!/bin/bash
CONFIG_FOLDER=./config
JAVA_HOME=/home/lorenzo/Downloads/jdk1.7.0_25/bin
CHARSET=utf8
$JAVA_HOME/java -DconfigFolder=$CONFIG_FOLDER -jar com.lorenzo.myapp.jar
When I run the script I get the following error:
/java: not foundmyscript.sh: 5: myscritp.sh: /home/lorenzo/Downloads/jdk1.7.0_25/bin
Any idea?
PS myscript.sh is the posted script.
EDIT:
I've found a partial solution:
#!/bin/bash
CONFIG_FOLDER=./config
export PATH=$PATH:/home/user/jdk1.7/bin
java -DconfigFolder=$CONFIG_FOLDER -jar com.lorenzo.myapp.jar
But now, I've another problem: the value of $CONFIG_FOLDER is empty when i run the script. Why?
Finally i've found solution! I wrote the script under Windows operative system. If i I open the script under Linux with vim text editor the script appear in this way:
#!/bin/bash^M
CONFIG_FOLDER=./config^M
JAVA_HOME=/home/lorenzo/Downloads/jdk1.7.0_25/bin^M
CHARSET=utf8^M
$JAVA_HOME/java -DconfigFolder=$CONFIG_FOLDER -jar com.lorenzo.myapp.jar^M
The script is dirty! After deleted all ^M the script worked!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.