Richard Gomes
2010-10-20 02:50:29 UTC
Hi guys,
I've recently downloaded JXplorer and I found two issues in script
jxplorer.sh and I also found another potential issue.
1st issue:
When running jxplorer.sh from any directory (except from the
installation directory) or when there are symlinks, the script may fails
if an user HAS a valid Java environment defined.
The solution is easy: We only need to move these lines...
basename=`basename $0`
dirname=`dirname $0`
cd ${dirname}
dirname=`pwd`
... to the top, which means that $dirname will always contain the actual
directory where jxplorer.sh is sitting on, regardless of the location
where it is launched, regardless presence of symlinks or not, regardless
a valid Java environment defined or not.
2nd issue:
JAVAV must be defined relative to $OPTJX and not the relative to the
arbitrary location "/opt/jxplorer".
#wrong: JAVAV=/opt/jxplorer/jre/bin/java
JAVAV=${OPTJX}/jre/bin/java
Potential issue:
When an user DOES NOT have a Java environment defined, jxplorer.sh
provides one, which is a relative directory called jre.
Well... I've downloaded the zipped Java distribution (not a pre-packaged
distribution to my environment) and there's no "jre" directory in there!
which means that jxplorer.sh will fail anyway when an user does not have
a Java environment configured.
In fact... it does not make sense to distribute a jre directory because
we don't know which architecture is need... x86? PowerPC? ARM? 32bits?
64bits? whatever?
So, in this case, jxplorer.sh should simply provide a message and quit.
Please find attached the jxplorer.sh file I changed in order to address
all these issues I mentioned above. I've tested in order to simulate an
user which HAS a valid Java environment defined and also when no Java
environment is defined. I removed unused code which would only pollute
the script instead of provide any useful history information of changes.
I hope it helps.
Cheers :)
I've recently downloaded JXplorer and I found two issues in script
jxplorer.sh and I also found another potential issue.
1st issue:
When running jxplorer.sh from any directory (except from the
installation directory) or when there are symlinks, the script may fails
if an user HAS a valid Java environment defined.
The solution is easy: We only need to move these lines...
basename=`basename $0`
dirname=`dirname $0`
cd ${dirname}
dirname=`pwd`
... to the top, which means that $dirname will always contain the actual
directory where jxplorer.sh is sitting on, regardless of the location
where it is launched, regardless presence of symlinks or not, regardless
a valid Java environment defined or not.
2nd issue:
JAVAV must be defined relative to $OPTJX and not the relative to the
arbitrary location "/opt/jxplorer".
#wrong: JAVAV=/opt/jxplorer/jre/bin/java
JAVAV=${OPTJX}/jre/bin/java
Potential issue:
When an user DOES NOT have a Java environment defined, jxplorer.sh
provides one, which is a relative directory called jre.
Well... I've downloaded the zipped Java distribution (not a pre-packaged
distribution to my environment) and there's no "jre" directory in there!
which means that jxplorer.sh will fail anyway when an user does not have
a Java environment configured.
In fact... it does not make sense to distribute a jre directory because
we don't know which architecture is need... x86? PowerPC? ARM? 32bits?
64bits? whatever?
So, in this case, jxplorer.sh should simply provide a message and quit.
Please find attached the jxplorer.sh file I changed in order to address
all these issues I mentioned above. I've tested in order to simulate an
user which HAS a valid Java environment defined and also when no Java
environment is defined. I removed unused code which would only pollute
the script instead of provide any useful history information of changes.
I hope it helps.
Cheers :)
--
Richard Gomes
M: +44(77)9955-6813
http://tinyurl.com/frgomes
twitter: frgomes
JQuantLib is a library for Quantitative Finance written in Java.
http://www.jquantlib.org/
twitter: jquantlib
Richard Gomes
M: +44(77)9955-6813
http://tinyurl.com/frgomes
twitter: frgomes
JQuantLib is a library for Quantitative Finance written in Java.
http://www.jquantlib.org/
twitter: jquantlib