You are not logged in.

#1 2008-11-11 04:23:20

cjpembo
Member
Registered: 2008-08-06
Posts: 105

Need a little help understanding java and /etc/profile.d/***

A few days ago I installed jre-6u10-1 and jdk-6u10-1 via pacman on my desktop machine; for the web plugin.
The packages installed in /opt/java/...
I later installed jedit, via pacman.  It runs fine as it (/usr/bin/jedit) is hardcoded to look for java in /opt/java/...

Today, I installed jedit (pacman -S jedit) on my laptop which did not have any java installed.
Pacman automatically installed openjdk6-jre-6u10-1 as a prerequisite.
Openjdk installs to /usr/lib/jvm/..., therefore jedit fails as /opt/java... is non-existent.

I suppose Sun's java and the opensource version are installed in different locations to keep from overwriting each other.
I could easily edit /usr/bin/jedit to point to the openjdk location and it would work.

But I'm a little uncertain of the following three files:

Sun's java installs /etc/profile.d/jre.sh and /etc/profile.d/jdk.sh
which do the following (respectively):

export PATH=$PATH:/opt/java/jre/bin
if [ ! -f /etc/profile.d/jdk.sh ]; then
        export JAVA_HOME=/opt/java/jre
fi

and

export J2SDKDIR=/opt/java
export PATH=$PATH:/opt/java/bin
export JAVA_HOME=/opt/java

The opensource java package installs /etc/profile/openjdk6.sh
which does the following:

export J2SDKDIR=/usr/lib/jvm/java-1.6.0-openjdk
export J2REDIR=$J2SDKDIR/jre
export JAVAHOME=/usr/lib/jvm/java-1.6.0-openjdk
#export CLASSPATH="${CLASSPATH:+$CLASSPATH:}$J2SDKDIR/lib:$J2REDIR/lib"

So I am left with a few options:
1.  edit /usr/bin/jedit to look in the opensource location
2.  edit /usr/bin/jedit to use the $J2SDKDIR variable when looking for java
3.  update the $PATH via /etc/profile.d/openjdk6.sh to include java's location

I think all three methods would work, but I have limited experience with java and would like some input as to which proposed solution is the best going forward.
What methods are other java apps using to find java?

Thanks

(edit: more descriptive title)

Last edited by cjpembo (2008-11-11 04:24:47)

Offline

#2 2008-11-11 05:17:23

peart
Member
From: Kanuckistan
Registered: 2003-07-28
Posts: 510

Re: Need a little help understanding java and /etc/profile.d/***

I think the best option would be to ask the maintainer to modify the jedit-bin file, and have it launch

$J2SDKDIR/bin/jre/java cp $CP -Djedit.home="/usr/share/jedit" -mx${JAVA_HEAP_SIZE}m org.gjt.sp.jedit.jEdit $@

That way, it should work with both java implementations (completely untested, btw.)

Offline

Board footer

Powered by FluxBB