The issue reported in the previous "closed-fixed" ticket #1287 (https://sourceforge.net/p/squirrel-sql/bugs/1287/) is introduced again to the launcher script for version 3.8.0
On MacOS, the launcher script contains a hard-coded reference to Contents/Resources/Java
if $macosx ; then
SQUIRREL_SQL_HOME=`dirname "$0"`/Contents/Resources/Java
else
SQUIRREL_SQL_HOME=`dirname "$0"`
fi
The should work correctly when the application is installed through the standard installer procedure, but fails to start Squirrel SQL when one uses the plain ZIP version (since there, the original (non-Mac specific) directory layout is present)
Please see the original ticket #1287 (https://sourceforge.net/p/squirrel-sql/bugs/1287/) for proposed solution and further details.
I've replicated this problem after running the installer. The launcher script is called when I click the application icon, and it fails silently. When I add some echo calls to the script and run it from the command line, I can see it doesn't correctly set the value of SQUIRREL_SQL_HOME, which breaks the JavaVersionChecker call.
(Note: Peter and I are unrelated AFAIK.)
Peter,
the 3.8.0 script contains the code you suggested in bug #1287 which itself contains a reference to Contents/Resources/Java. But the code you introduced in the following if statement tries to redefine the variable SQUIRREL_SQL_HOME.
It would be nice if you could check your suggested change again and compare it to the existing 3.8.0 script.
In the latest snapshots the MAC OS and Linux-Scripts where separated. It would be very kind if you could have a look at that version, too.
Thanks in advance
Gerd
Gerd,
I might be missing something, but I do not see my suggested code changes in the squirrel-sql.sh from squirrelsql-3.8.0-standard.zip (downloaded from Squirrel SQL's home page)
As you see the check I proposed is not there ( could this maybe a build issue?):
My proposed solution of changing
to
is just not there. I am wondering, why is that, because I was under the impression the proposed code change was accepted into the code base.
Peter,
sorry, I didn't update the scripts of the plain zip releases.
I just released a new snapshot
https://sourceforge.net/projects/squirrel-sql/files/3-snapshots/snapshot-20171106_2206/
that as usually contains the installers an exceptionally also the plain zips. The plain zip scripts are updated in the snapshot. Please note that there are now separate scripts for Linux/Unix and Mac. The installers automatically come with the right script but the plain zip packages now contain squirrel-sql.sh for Linux/Unix and squirrel-sql-mac.sh for the Mac.
It would be nice if you had a look.
Thanks in advance
Gerd
Hi Gerd,
I tested this, and unfortunately, there seem to be some issues. The launcher script works properly if you start the script from the same directory, but fails if you start from anywhere else:
This is the output I see:
I think the original fix proposed in https://sourceforge.net/p/squirrel-sql/bugs/1287/ should work correctly. I personally don't like the idea of having separate launcher script for Mac.
Peter,
although this change contradicts the change made for bug
https://sourceforge.net/p/squirrel-sql/bugs/1310
I changed it back to your prefered version.
Since there seems to be no version that works for all Mac users the problem is well documented in the script itself to allow users to try out which version works for them.
I just released a snapshot
https://sourceforge.net/projects/squirrel-sql/files/3-snapshots/snapshot-20171118_0029/
containing even the plain zips. It would be nice, Peter, if you could give it another try.
Thanks
Gerd
Last edit: Gerd Wagner 2017-11-18
The following changes seem to work for me when invoking the script manually (from any dir) as
/Applications/SQuirreLSQL.app/Contents/MacOS/squirrel-sql.shand when double clicking the icon from the Applications folder:change
to
Just this fix will make the script work when invoked manually from the terminal. However, when you double click the icon and get the dreaded
Service exited with abnormal code: 127error in console, you can't see any of your echo statements. I wrapped the entire last line of the script in a subshell, and logged it to syslog. This is what printed in the console:the last line of the script needs to change from:
to
to quote the
$JAVACMDinvocation, since (at least on my box, and I think many others)$JAVACMDresolves to a directory with a space when doubleclicked (such as/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java) but when run from the terminal resolves to a directory without a space (such as/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java). Some Macs might resolve the doubleclick invocation to a dir without a space, but quoting$JAVACMDwill make it work in all cases.Hoepfully this also works for others.
Missed one instance. Also need to change from:
to
Given that the unquoted
$JAVACMDfails with a 127, the script would just keep chugging along, whether version was correct or not. Quoting it makes sure the command is always actually invoked. I would also change theifstatement fromto
in order to catch all possible failure types, since (I think) you want to fail for any non zero error type, vs only failing explicitly on 1.
Harry,
except from
SQUIRREL_SQL_HOME=
dirname "$0"/../Resources/Javaall your suggestions are integrated in the MAC scripts.
SQUIRREL_SQL_HOME=
dirname "$0"/../Resources/Javawas added as a comment only. The lines next to the comment were subject to a lively discussion. Part of it you can find above other parts are in bugs 1287, 1310.
A comment above the different possible lines to which yours now belongs hints users to try out which works for them.
A new snapshot will be released soon that contains your changes. It would be nice if you could give it a try.
Thanks
Gerd
Gerd,
Thanks for the update. I will try the latest snapshot tonight ot tomorrow. On the one item that you left two versions of the command for, I was unable to find any additional discussion. Is there any thread I can read with the details?
The reason I ask is that, according to Apple, SquirrelQL is using the correct directory structure:
When you double-click on SQuirreLSQL icon in the Application folder on a Mac, the line you left active in scquirrel-sql.sh will resolve
to
When you append
/Contents/Resources/Javato that, you get/Applications/SQuirreLSQL.app/Contents/MacOS/Contents/Resources/Javawhich clearly is not the path to reach the "Java" directory in the directory tree. The path you want is/Applications/SQuirreLSQL.app/Contents/Resources/Java. You could usedirnametwice to get this, and append/Contents/Resources/Javato it, or what I did, which used ".." given that we know where we are in the bundle reletive hierarchy. Unlessdirname "$0"somehow returns a different value on some mac systems when running the script from the place it is installed by the installer, I don't see how the derived path can ever be correct. Like I said, I would love to understand the opposite viewpoint, so if it is documented somewhere, can you provide a link?Last edit: Harry Evans 2017-12-06
Hi,
This seems to be a problem in the released squirrel-sql-3.8.0-MACOSX-install.jar
I installed using the wizard-type installer into /Applications/SQuirreLSQL.app
Clicking on the new application icon then did nothing (other than wobble the icon for a couple of seconds)
I found the squirrel-sql.sh and found that the paths are incorrect as described in this thread.
If I run the script through Terminal I see the error: Error: Could not find or load main class JavaVersionChecker
I can hack the script to correct the path:
UNIX_STYLE_HOME=$UNIX_STYLE_HOME/../Resources/Java
Is this issue being addressed?
Is there a different way to install on Mac OS please?
Regards,
Connor
@Harry: All the later (about from this autumn ) discussion took place in
@Connor: There were quite some discussion and changes concerning the Mac OS script after the 3.8.0 release. Could you please try out the latest snapshot here:
https://sourceforge.net/projects/squirrel-sql/files/3-snapshots/
In case you are interested in plain zip packages the latest snapshot containing these is
https://sourceforge.net/projects/squirrel-sql/files/3-snapshots/snapshot-20171118_0029/
The latest snapshot is also still missing quotes in this line:
I had to add the double-quotes around the path name in order to get SQuirrelSQL to launch. Can IzPack be configured to put those quotes in?
Pete, the double quotes are added and are committed to our GIT repository. The changes will be available in future snapshots and versions.
I had the problem, that the squirrel bash script didn't start the program.
When I looked into the script, I found a comment saying:
"Mac users are not able which of the three lines below works correctly"
Since I have a Macbook with MacOS High Sierra ... here are my two cents ...
$ uname -a
Darwin <myhostname> 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64</myhostname>
When you call squirrel as App, the bash script variable $0 returns the absolute path to the directory, the script resides in. Assuming the standard installation directory /Application this means e.g.:
/Applications/SQuirreLSQL.app/Contents/MacOS
I used the following code to set the squirrel home:
On my mac this works. Personally I would recommend the way ant uses, to determine JAVA_HOME and add the lib path to the Resources/Java/ via a lib option as the ant bash script does. That way you coud base your code on a well tested script and do it in a way that has proven quite stable.
Hope I could help a little bit ... Keep up the good work.
Last edit: Frank Kemmer 2018-04-25
Frank,
just added your suggestion as a new alternative to the MAC OS launch script. It will be available in future snapshots and versions.
Thanks
Gerd
Alternative 2 worked for me. I didn't try 3. I was having issues previously, so instead of just opening the jar via Finder I used a specific java with -jar in the terminal to open it.
SQUIRREL_SQL_HOME=$(echo $ABSPATH | grep -o '^/.*/Contents/')Resources/JavaMacOS 10.14.1
My Java path: /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
Java version: build 1.8.0_202-ea-b03
Jvm version: 64-Bit Server VM (build 25.202-b03, mixed mode)
Why not put some debugging code in the script to suggest switching the path inside the script if it fails? That would have saved me a lot of time, I thought it was a Java issue.
Joseph, could you suggest such a change to the script?