Trying to get scala and sbt setup on my home computer windows 10 to practice.
Have installed:
- Scala version 2.12.4
- Sbt 1.1.4
- java version "9.0.4"
- Java(TM) SE Runtime Environment (build 9.0.4+11)
- Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
Running the below command in git bash(in admin)
sbt new scala/projectname.g8
Getting this error
/c/Program Files (x86)/sbt/bin/sbt-launch-lib.bash: line 126: conditional binary operator expected
/c/Program Files (x86)/sbt/bin/sbt-launch-lib.bash: line 126: syntax error near `=~'
/c/Program Files (x86)/sbt/bin/sbt-launch-lib.bash: line 126: ` elif [[ "${JAVA_OPTS}" =~ Use.*GC ]] || [[ "${JAVA_TOOL_OPTIONS}" =~ Use.*GC ]] || [[ "${SBT_OPTS}" =~ Use.*GC ]] ; then'
/c/Program Files (x86)/sbt/bin/sbt: line 157: run: command not found
I've tried to reinstall all dependencies, repair sbt install.
When I go to the directory the files are hidden.
Code from c/Program Files (x86)/sbt/bin/sbt-launch-lib.bash line 120 - 133:
get_gc_opts () {
local older_than_9=$(( $java_version < 9 ))
if [[ "$older_than_9" == "1" ]]; then
# don't need to worry about gc
echo ""
elif [[ "${JAVA_OPTS}" =~ Use.*GC ]] || [[ "${JAVA_TOOL_OPTIONS}" =~ Use.*GC ]] || [[ "${SBT_OPTS}" =~ Use.*GC ]] ; then
# GC arg has been passed in - don't change
echo ""
else
# Java 9+ so revert to old
echo "-XX:+UseParallelGC"
fi
}
Greatly appreciate any help on this!
SOLVED: the =~ operator is not supported in bash versions >3.0. reinstalling git bash for windows solved this issue.
The commands also work fine for jdk 1.8 or above.