Java path issue (Unix/Linux)

Guiserver, GTK-server, OpenGL, PostScript,
HTML 5, MIDI, IDE
Locked
pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Java path issue (Unix/Linux)

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

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

pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

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

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

No dont use the 'wich option...

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

pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Post 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...

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Post by pjot »

Hi Lutz,

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

Thanks
Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

It will be in 9.3, try it out here:

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

Lutz

pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Post 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

tom
Posts: 168
Joined: Wed Jul 14, 2004 10:32 pm

Post by tom »

Bingo.

Locked