Java path issue (Unix/Linux)

Started by pjot, December 28, 2007, 03:56:09 AM

Previous topic - Next topic

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

Lutz

#1
$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

newdep

#2
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.
-- (define? (Cornflakes))

pjot

#3
Maybe use an (exec "which java")....?


Quote
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")

newdep

#4
No dont use the 'wich option...



many systems have multiple java's running.. ;-)
-- (define? (Cornflakes))

pjot

#5
Quote
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...

Lutz

#6
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

pjot

#7
Hi Lutz,



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



Thanks

Peter

Lutz

#8
It will be in 9.3, try it out here:



http://newlisp.org/downloads/development/guiserver.lsp-113">http://newlisp.org/downloads/developmen ... er.lsp-113">http://newlisp.org/downloads/development/guiserver.lsp-113



Lutz

pjot

#9
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

tom

#10
Bingo.