Tiny Core Base > Micro Core

Setting Path to Java JDK in /etc/profile in Microcore

<< < (3/3)

Terminator3000:
So as I say its a little baffling,you would think it would be pretty straightforward but it doesnt seem to work.
Java installation is fine at /opt./java/jdk1.6.0_21/    but attempts to set path to it so far prove futile !

(Unless there is some way that java.sh script should be initialised on boot)

So for the moment I have a java.sh file in /etc/profile.d/ with the following code

export JAVA_HOME=/opt/java/jdk1.6.0_21
export PATH=$PATH:$JAVA_HOME/bin

Doesnt work !

More tips welcome !

Terminator3000:
UPDATE ON ABOVE !!

Since rebooting (although I rebooted a few times before) it now seems that it is working.

That is,creating the java.sh file in the /etc/profile.d/ directory with the above posted lines of code written to it seems to do the job.

Now my 'echo $JAVA_HOME' command returns the path /opt/java/jdk1.6.0_21   so far so good !

maro:
All right, so far I get that your attempt to change '$PATH' has not worked as expected (the "empty response" indicates that the variable is not set.

I've now done a test using exactly these commands:
cat << EOF | sudo tee /etc/profile.d/java.sh > /dev/null
export JAVA_HOME=/opt/java/jdk1.6.0_21
export PATH=\$PATH:\$JAVA_HOME/bin

( date ; echo \$JAVA_HOME ; echo \$PATH ) >> /tmp/java_path.log
EOF

grep -q 'etc/profile.d' /opt/.filetool.lst \
    || echo 'etc/profile.d' >> /opt/.filetool.lst

filetool.sh -b

And the result is as expected: the $PATH has been changed to the desired new one after the next restart. Obviously the last line of the script (i.e. the one with the 'date' command) can be removed after it's working OK.

I got to admit that I had a bit of a laugh when reading:

--- Quote from: Terminator3000 on September 29, 2010, 03:55:17 PM ---Seems that getting exactly the right syntax is paramount.

--- End quote ---
In my experience in computing syntax is highly significant. It's not like cooking where it probably does not matter whether one uses 95g of sugar instead of 100g ...


EDIT: I only now saw the previous post about the success, I still leave this one standing for future reference. Or shall I call "educational" purpose?

Terminator3000:
Sorry for stating the blindingly obvious regarding the syntax,but I'm glad it tickled your funny bone !

I guess it was just frustration at not getting a simple task completed properly.

So  many thanks for your help but expect more problems from me as I quite like Microcore !

Cheers.

Navigation

[0] Message Index

[*] Previous page

Go to full version