Tiny Core Base > Micro Core

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

(1/3) > >>

Terminator3000:
Hi,having installed Java jdk1.6 (not openjdk extension) I'm trying to set the correct path but having no luck. I.ve placed it in /opt/java/jdk1.6.0_21/ and appended the path to the path line at the top of /etc/profile.
Ive added export path of JAVA_HOME also but its still not showing for an echo command.

Tips on setting up the correct path and actually getting it working welcome !

danielibarnes:
It would help to elaborate on your modification to /etc/profile. I presume you added
export JAVA_HOME=/opt/java/jdk1.6.0_21
at the top?

It is not considered a good idea to modify /etc/profile directly. It is preferable to add a script (must end in .sh) in the /etc/profile.d/ directory that includes the necessary settings. This way, the settings can be added to your backup file or even an extension.

BTW, adding
PATH=$PATH:$JAVA_HOME/bin
is helpful also.

Terminator3000:
Hi,having seen a few different methods it is dificult to know which one to use.
my full path is-:)   /opt/java/jdk1.6.0_21/bin/java      that is right up to the exe file.

The path at the top of /etc/profile is I presume just for the bash shell so I have un-appended the java path.
So still looking for the correct way to get the above java path recognised.

danielibarnes:
Include the snippet from your /etc/profile (or attach the file if that is easier). I am not sure I understand what you changed.

My recommendation is to create the file /etc/profile.d/java.sh containing:

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

This should work as desired.

maro:
@Terminator3000: In my experience these kind of problems should be solved in two stages:
1. In a "standard" login shell test all the changes to variable settings until they work satisfactorily, e.g. adding the additional directory to $PATH (and not a target executable).
2. Make those admendment permanent by integrating them in an appropriate way.

I'm a bit hazy whether you had achieved the first target. Nevertheless I fully concur with what danielibarnes has meanwhile suggested. This should work based on the information you have otherwise provided.

Please note: The file name in '/etc/profile.d' has to conform to the "*.sh" naming convention (as suggested by danielibarnes). And don't forget to make an appropriate entry to '/opt/.filetool.lst', e.g. via echo 'etc/profile.d' >> /opt/.filetool.lst (which adds the whole directory and is therefore more future-proof). Finally don't forget to execute a backup, e.g. via  filetool.sh -b to include the change in your backup.

Navigation

[0] Message Index

[#] Next page

Go to full version