Page 1 of 1

Java path issue (Unix/Linux)

Posted: Fri Dec 28, 2007 11:56 am
by pjot
Hi,

After upgrading my Linux system(s) to a newer release, the GUIserver did not run anymore.

After some troubleshooting it appears that the file '/usr/share/newlisp/guiserver.lsp' looks for a Java binary in '/usr/bin'.

However, on Slackware-like systems (also Zenwalk) the java binary resides in '/usr/lib/java/bin'.

Starting a GUI program now returns "Could not connect to guiserver".

Porbably the hardcoded path for the Java binary should be changed to a more flexible mechanism?

What we suggest is using the environment variable "JAVA_HOME". This variable should point to the installation directory of Java on a Unix/Linux system. On my system it points to '/usr/lib/java'. The Java binary then can be found in the 'bin' subdirectory, e.g. $JAVA_HOME/bin.

This solution should work for all Unix/BSD/Linux systems.

Regards
Peter

Posted: Fri Dec 28, 2007 2:32 pm
by Lutz
$JAVA_HOME/bin would work on OS X, but seems not to work on another LINUX (at Amazon EC2 server farm, I think some RedHat derivate).

Who else running Linux (or any other UNIX) can find the java executable in $JAVA_HOME/bin, or cannot find?

Ofcourse I always could code for both possibilities

Lutz

Posted: Fri Dec 28, 2007 3:12 pm
by newdep
Hi Lutz,

When installing JAVA from a tgz package (downloaded from java.com)
the default path is /usr/lib/java.x.x.x

The symlink from the /usr/bin is removed after an upgrade or fresh install.
I also run slackware JAVA_HOME is the default here..

The best way to notify users is to document the Symlink in /usr/bin/java
in the GS manual... better would be the env setting ofcourse..

Package managers do always create exceptions...
that why i always stick with tgz ;-)



Norman.

Posted: Fri Dec 28, 2007 3:12 pm
by pjot
Maybe use an (exec "which java")....?
peter[gtk-server-2.2.2]$ newlisp
newLISP v.9.2.11 on Linux, execute 'newlisp -h' for more info.

> (exec "which java")
("/usr/lib/java/bin/java")

Posted: Fri Dec 28, 2007 3:15 pm
by newdep
No dont use the 'wich option...

many systems have multiple java's running.. ;-)

Posted: Fri Dec 28, 2007 3:39 pm
by pjot
many systems have multiple java's running.. ;-)
So?

newLisp will then at least use a Java binary, the first Java binary it finds. If this isn't working, it's a system setup issue.

Right now the guiserver.lsp context does not find anything....

The 'which' can always be used as a last resort...

Posted: Fri Dec 28, 2007 6:57 pm
by Lutz
We will leave it like it is for Win32 and Mac OS X, for others we try first $JAVA_HOME/bin/java if $JAVA_HOME is defined, then try /usr/bin/java

That should make everybody happy

Lutz

Posted: Tue Jan 08, 2008 6:07 pm
by pjot
Hi Lutz,

This is stil not changed in 9.2.12...???

Thanks
Peter

Posted: Tue Jan 08, 2008 6:28 pm
by Lutz
It will be in 9.3, try it out here:

http://newlisp.org/downloads/developmen ... er.lsp-113

Lutz

Posted: Tue Jan 08, 2008 7:25 pm
by pjot
Works perfect!

This way all *nix OS's should be able to run the guiserver as the context now relies on the official environment variable $JAVA_HOME.

Thanks again,

Peter

Posted: Tue Jan 08, 2008 10:34 pm
by tom
Bingo.