Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix java 8 version check #260

Merged
merged 1 commit into from
Jun 21, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ get_mem_opts () {
[[ "${java_args[@]}" == *-XX:ReservedCodeCacheSize* ]];
then
echo ""
elif [[ !$no_java_version_check ]] && [[ "$java_version" > "1.8" ]]; then
elif [[ !$no_version_check ]] && [[ "$java_version" > "1.8" ]]; then
echo "-Xms${mem}m -Xmx${mem}m -XX:ReservedCodeCacheSize=${codecache}m"
else
echo "-Xms${mem}m -Xmx${mem}m -XX:MaxPermSize=${perm}m -XX:ReservedCodeCacheSize=${codecache}m"
Expand Down Expand Up @@ -284,7 +284,7 @@ loadConfigFile() {
# Now check to see if it's a good enough version
# TODO - Check to see if we have a configured default java version, otherwise use 1.6
java_version_check() {
declare -r java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}')
readonly java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readonly declares java_version globally and declare -r doesn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I found while testing with the mentioned bash version. I'm by no means a bash expert though so maybe there's a better way to do this? I stumbled upon the readonly trick here: http://stackoverflow.com/a/12158728/547212

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very interesting as this seems to depend on the bash version. I'll need to take a closer look at this.
Thanks for the research!

if [[ "$java_version" == "" ]]; then
echo
echo No java installations was detected.
Expand Down