1

This question already has an answer here:

I have installed Eclipse Oxygen;when I type

 export PATH=$PATH:/home/ivan/java-oxygen/eclipse

in the bash, I can launch eclipse from bash from any location, however, no matter whether I add

PATH=$PATH:/home/ivan/java-oxygen/eclipse

or

export PATH=$PATH:/home/ivan/java-oxygen/eclipse

to /.bashrc or /etc/bash.bashrc, I cannot launch Eclipse without typing

export PATH=$PATH:/home/ivan/java-oxygen/eclipse

every time I launch the new bash.

marked as duplicate by Gilles bash Aug 13 '17 at 22:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Post an echo $PATH output from a new bash session. – L29Ah Aug 13 '17 at 10:29
  • @L29Ah /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games: /usr/local/games:/home/ivan/Documents/node-v6.11.0-linux-x64/bin/ – NiHao92 Aug 13 '17 at 11:36
  • @GAD3R doesn't work – NiHao92 Aug 13 '17 at 11:36
  • Are there additional PATH definitions? grep PATH /etc/bash.bashrc ~/.bashrc Did you really mean /.bashrc or is that a typo? Add the line echo foo below your export PATH line and see whether it is executed. – Hauke Laging Aug 13 '17 at 12:23
  • @HaukeLaging solved. What needed was to add export PATH=$PATH:/home/ivan/java-oxygen/eclipse to ~/.profile – NiHao92 Aug 13 '17 at 13:02
0

Maybe just for the sake of clarity

/.bashrc would be a file in your root directory /. This file could never be read by any user.

On the other hand ~/.bashrc means the .bashrc file from the current user.

Another option is to edit the .bashrc file in your /etc/skel directory, this change is global and every user in the system would have it as default when created.

.bash_profile as the official docs say:

This is the preferred configuration file for configuring user 
environments individually. In this file, users can add extra 
configuration options or change default settings:

This file adds some per user extra variables.

PS. If we talk about security, it is not recommendable to have exec paths in your home directory, the most secure option would be to have your eclipse in some place like /opt and as root create a symlink to the binary like:

cd /usr/bin 
ln -s /opt/path/to/eclipse

This will produce a link for all the users and you won't need to add this specific ( and probably dangerous ENV var for every user)

Not the answer you're looking for? Browse other questions tagged or ask your own question.