Open jsotuyod opened 7 years ago
We're going round in circles on this issue; see the history of the script. It would be nice if someone could sit down and find a way of setting up the script in a way that works reliably on all platforms (or, failing that, detects the platform and switches behavior accordingly).
TL;DR : proposal = drop the scripts, use gradle facilities (or maven if it can do it)
The crux of the problem AFAICS is that tools.jar must be on the classpath, which requires the script to be non-trivial (trivial would be to just use the jar).
My proposal for resolving this issue, as well as #122 is in #187 : if we switch to gradle (although for all I know the same can be achieved using maven - can anyone comment?) it can be used instead of the generated scripts. In gradle it's easy to declare the necessary dependency on what is used from the tools.jar.
The end result is that when the hp project is checked out, all that is needed to run the UI is the command ./gradlew run
. A ./gradlew runConsole
(or something similar) can be added trivially to start the console.
AFAIK, the gradle solution would work on any platform (OSX, Linux, Windows - the only one I haven't tried for now is OSX). The wrapper mechanism (which uses the gradlew script which is checked in, with a version both for Win and non-Win) ensures you don't even need to install gradle.
The above is for people who have a JDK installed (gradle will compile and create the jar the first time). If only a JRE is available, we can use a deployment module for gradle (such as https://github.com/shemnon/javafx-gradle) which allows building of a distribution. I've successfully used it in the past to create a self-contained zip/tgz which contains a Win or nonWin executable running the project. The JRE is also included. This I could do in less than half a day. I think the JDK itself also contains deployment tools these days, those could be used too.
on OSX, you can install greadlink via "brew install greadlink" and then use this script content below to replace that in GUI script:
set -eu
java_path=$(greadlink -f $(which javac))
[ -f /usr/libexec/java_home ] && java_home=/usr/libexec/java_home
|| java_home=$(echo ${java_path} | sed 's/javac$//')
tools_path="$java_home/lib/tools.jar"
[ -f ${tools_path} ] || (echo "Could not find tools.jar at ${tools_path}" && exit 1)
BASEDIR=$(dirname "$0")
java -cp $tools_path:${BASEDIR}/honest-profiler.jar com.insightfullogic.honest_profiler.ports.javafx.JavaFXApplication
Is this still an issue?
@nitsanw this is still an issue.
@snowe2010 I don't have a Mac to test on, so sadly can't help. Please try the workaround above, and report back. If you can resolve the issue and contribute a PR that would be great.
Workaround for me was brew install coreutils
and then doing as said. I'm not experienced in this area, so I'm not sure I could submit an effective PR.
The script fails on MacOS with: