SQuirrelSQL on Mac OS X doesn't want jdk1.8
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
Is this during installation or running? I no longer have a mac to test this on.
Within the installer files (sql12/installer/mac/izpack-mac.xml) it specifies javaversion 1.6 which is supposed to be a lexical comparison against the java.version system property according to http://izpack.org/documentation/installation-files.html. That suggests it wouldn't have worked with 1.7 either though.Worth a try just changing that to 1.8 and seeing what happens.....
Last edit: Neville Rowe 2016-01-30
There is an new snapshot http://sourceforge.net/projects/squirrel-sql/files/3-snapshots/snapshot-20160130_2058/squirrel-sql-snapshot-20160130_2058-MACOSX-install.jar that contains Rowe's suggestion. It would be great if you could give it a try and let me know if it works.
If anyone of you also had access to a Mac with JDK 1.6 or 1.7 that would be great.
Last edit: Gerd Wagner 2016-01-30
Hi Gerd,
That snapshot works fine with Java 1.8. I also retried version 3.7 and now that works too, but I don't know why.
Best regards,
Werner.
My last post was wrong. Over the weekend I had to install the legacy Java 1.6 again for LibreOffice 5 and that is why it worked. After removing it neither the snapshot nor version 3.7 work.
Sorry about that.
So I'll revert the change Neville suggested. Perhaps there is someone out there who has access to a Mac and can look for fix.
I'd very much appreciate a patch.
Gerd
Check squirrel-sql.sh in the application bundle (Contents/MacOS)
The JavaVersionCheck appears not to do exactly as stated in the comments. Asking for just version 1.6 is not quite enough (versioncheck needs to be fixed - or so it seems :-).
Add 1.8 to the line with "JavaVersionChecker", around line 75 and save.
Below run in Terminal.
Installed jdk/jre:
java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
java -cp Resources/Java/lib/versioncheck.jar JavaVersionChecker 1.6 -- fails
java -cp Resources/Java/lib/versioncheck.jar JavaVersionChecker 1.7 -- fails
java -cp Resources/Java/lib/versioncheck.jar JavaVersionChecker 1.8 -- ok
java -cp Resources/Java/lib/versioncheck.jar 1.6 1.7 1.8 -- ok, obviously
/jørgen
I just ran the MacOS Installer (this works although I don't have a MAC) and looked at Contents/MacOS/squirrel-sql.sh. For SQuirrel version 3.7 as well as for the latest snapshot the version check line is:
$JAVACMD -cp "$UNIX_STYLE_HOME/lib/versioncheck.jar" JavaVersionChecker 1.6 1.7 1.8
Agreed - I apparently an old version lying around.
Maybe change the comment about versioncheck in the squirrel-sql.sh file; versioncheck seems not to do quite as the comment says?
I think the intent of the "# SQuirreL home." block does not behave on Mac OS x Darwin. For the test to work on line 56 it would need to resolve to
SQUIRREL_SQL_HOME='/Applications/SQuirreLSQL.app/Contents/Resources/Java'
The dirname seems to resolve relativley to . and fails. Subsequently the zip test fails and sets the home incorectly as the default also does not make sense.
If you are looking for a quick temp fix on a Mac, set the SQUIRREL_SQL_HOME to above.
I am trying to understand the use case for the zip file test and the else block. Perhaps someone can expand on this.
I
The attached file contains the script to run Squirrel on MacOS High Sierra 10.13.6
Max,
as you can see from this bug as well as from 1287, 1321, 1310 changes to MAC scripts are not trivial. Perhaps you would want to drop your version here:
https://sourceforge.net/p/squirrel-sql/patches/
This is I probably the best place to make it available.
Gerd
I'd forgotten about this - I gained a mac again a few months ago so I'll test and get it working again.
As of MacOS Catalina, these tweaks will no longer work, as Catalina seems to prevent the SQuirreLSQL.app package from running if squirrel-sql.sh is modified. As a workaround, I installed jenv using
brew install jenv, then set the global java version usingjenv global 13, where "13" is any valid JDK for SQuirrel.More info here: https://github.com/jenv/jenv
On MacOS Big Sur (11.1) I was able to edit squirrel-sql.sh as follows:
Finder: Go to: programs --> Open context menu on SQuirreLSQL --> Show contents --> Navigated to Contents/MacOS/squirrel-sql.sh --> In context menu for squirrel-sql.sh --> open with TextEdit
Note: The menu items were translated from German and may not exactly match the real English names.
Hello, I just installed SQuirrel on my MAC that has Big Sur 11.4 and I cannot launch SQuirrel . Gettin error that says: Your Java Virtual Machine version must be 11,12,13,14,15,16 to run Squirrel. Version used JVM 1.8.0.261. I followed some of the recommendations an updated my squirrel-sql.sh. I tried one at the time and none of them work. Can you please advise?. My squirrel-sql.sh looks like this: #! /bin/sh -x
NOTE: If this script DOES NOT WORK search for the CHANGE_HERE comment below
ABSPATH=$(cd "$(dirname "$0")"; pwd)
IZPACK_JAVA_HOME is filtered in by the IzPack installer when this script is installed
IZPACK_JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
We detect the java executable to use according to the following algorithm:
1. If it is located in JAVA_HOME, then we use that; or
2. If the one used by the IzPack installer is available then use that, otherwise
3. Use the java that is in the command path.
if [ -d "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
JAVACMD="$JAVA_HOME/bin/java"
elif [ -d "$IZPACK_JAVA_HOME" -a -x "$IZPACK_JAVA_HOME/bin/java" ]; then
JAVACMD="$IZPACK_JAVA_HOME/bin/java"
else
JAVACMD=java
fi
Are we running within Cygwin on some version of Windows or on Mac OS X?
macosx=false;
case "
uname -s" inDarwin*)
macosx=true
;;
esac
SQuirreL home.
if $macosx ; then
CHANGE_HERE
Mac users are not able to agree upon which of the three lines below works correctly, see bugs 1287, 1321, 1310.
Thus if you have problems running SQuirreL on IOS please try out the alternative lines.
Alternative 1
SQUIRREL_SQL_HOME=
dirname "$0"/Contents/Resources/JavaAlternative 2
SQUIRREL_SQL_HOME=$(echo $ABSPATH | grep -o '^/.*/Contents/')Resources/Java
Alternative 3
SQUIRREL_SQL_HOME=
dirname "$0"/../Resources/JavaAlternative 4 (thanks to Frank Kemmer)
APP_MacOS_DIR=$(dirname "$0")
APP_CONTENTS_DIR=$(dirname "${APP_MacOS_DIR}")
SQUIRREL_SQL_HOME="${APP_CONTENTS_DIR}/Resources/Java"
echo "### SQUIRREL_SQL_HOME: [${SQUIRREL_SQL_HOME}]"
Other Alternative Jun 24
SQUIRREL_SQL_HOME='/Applications/SQuirreLSQL.app/Contents/Resources/Java'
if [ ! -d "$SQUIRREL_SQL_HOME" ]; then
# We assume that this is the ZIP file extracted on MacOS,
# so, fall-back to the defult path
SQUIRREL_SQL_HOME=
dirname "$0"fi
else
SQUIRREL_SQL_HOME='/Applications/SQuirreLSQL.app'
fi
SQuirreL home in Unix format.
UNIX_STYLE_HOME="$SQUIRREL_SQL_HOME"
cd "$UNIX_STYLE_HOME"
Check to see if the JVM meets the minimum required to run SQuirreL and inform the user if not and skip
launch. versioncheck.jar is a special jar file which has been compiled with javac version 1.2.2, which
should be able to be run by that version or higher. The arguments to JavaVersionChecker below specify the
minimum acceptable version (first arg) and any other acceptable subsequent versions. <major>.<minor> should</minor></major>
be all that is necessary for the version form.
"$JAVACMD" -cp "$UNIX_STYLE_HOME/../Resources/Java/lib/versioncheck.jar" JavaVersionChecker 11 12 13 14 15 16
if [ "$?" != "0" ]; then
exit
fi
CP="$UNIX_STYLE_HOME"/squirrel-sql.jar:"$UNIX_STYLE_HOME"/lib/*
CP="$UNIX_STYLE_HOME"/../Resources/Java/squirrel-sql.jar:"$UNIX_STYLE_HOME"/../Resources/Java/lib/*
Define mac-specific system properties if running on Mac OS X
MACOSX_SQUIRREL_PROPS="-Dapple.laf.useScreenMenuBar=true -Dcom.apple.mrj.application.apple.menu.about.name=SQuirreLSQL -Dapple.awt.application.name=SQuirreLSQL"
NATIVE_LAF_PROP="--native-laf"
if $macosx ; then
# macosx provides unknown args to the script, causing SQuirreL to bail..
SCRIPT_ARGS=""
else
SCRIPT_ARGS="$1 $2 $3 $4 $5 $6 $7 $8 $9"
fi
Launch SQuirreL application
"$JAVACMD" -cp "$CP" $SQUIRREL_SQL_OPTS $MACOSX_SQUIRREL_PROPS -splash:"$SQUIRREL_SQL_HOME/icons/splash.jpg" net.sourceforge.squirrel_sql.client.Main --log-config-file "$UNIX_STYLE_HOME"/log4j.properties --squirrel-home "$UNIX_STYLE_HOME" $NATIVE_LAF_PROP $SCRIPT_ARGS
You're likely running post-4.2.0 release snapshot build. Note the SQuirreL home page states:
Current snapshot builds already contain changes that are incompatible with Java 8.