Score:1

Run java -jar from bash file

my flag

This is my .sh file and I'm trying to run it from a terminal, but it doesn't work even after checking paths, installing libc6-i386 and simplify it to a direct java call. Until here java path was not recognized. Does someone know how to do it?

#!/bin/bash
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
CLASSPATH=/home/daniel/test/commons-lang3-3.5.jar;/home/daniel/test/test-1.0.0.jar:.
$JAVA_HOME/bin/java -classpath $CLASSPATH com.test.Main
exit 0

Terminal

bac0n avatar
cn flag
Seems you have a `;` in your classpath.
de flag
ob2
You should add simple quote arround your value. `CLASSPATH='/home/daniel/test/commons-lang3-3.5.jar;/home/daniel/test/test-1.0.0.jar:.'`
hr flag
Does `test.sh` have DOS/Windows line endings? Check with `file test.sh`
danielgolive avatar
my flag
@bac0n seems the right separator is colon https://stackoverflow.com/a/219801/1163543
danielgolive avatar
my flag
@ob2 simple quote seems not allowed in this case
danielgolive avatar
my flag
@steeldriver you are right! the file had CRLF line terminators... I recreated the script without CRTL and replaced the semicolon by colon... the issue was solved! :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.