3

Trying to install java jre, I messed up the file bash.bashrc on Ubuntu 14.04, by adding these two lines at the end :

export PATH= $PATH:usr/java/bin/ ; 
export JAVA_HOME= $JAVA_HOME:usr/java/bin/java/

Now I cannot do any command on terminal. When I open terminal it give me these errors:

bash: export: `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:usr/java/bin/': not a valid identifier
bash: export: `:usr/java/bin/java/': not a valid identifier
bash: lesspipe: No such file or directory
bash: dircolors: No such file or directory
bash: ls: No such file or directory

Could anyone help?

2
  • delete the last two lines from that file. May 5, 2014 at 7:12
  • 1
    This is not a duplicate, the issue here is a specific syntax error (as has been answered already) and the answer in the "duplicate" is both overkill and irrelevant here since it is about ~/.bashrc while this one is about /etc/bash.bashrc.
    – terdon
    May 9, 2014 at 0:31

2 Answers 2

7

With:

export PATH= $PATH:usr/java/bin/ ; 
export JAVA_HOME= $JAVA_HOME:usr/java/bin/java/

bash: export: ':usr/java/bin/java/': not a valid identifier; Sure you left a space between JAVA_HOME= and $JAVA_HOME:usr/java/bin/java/, so export supposes that $JAVA_HOME:usr/java/bin/java/ is a second variable. Same case for 1st line too.

export: usage: export [-fn] [name[=value] ...] or export -p

... means it does support/expect multiple variables with name[=value] format.

Remove spaces (after =) and semicolon ; and add / before usr/ (as it should be a full path):

export PATH=$PATH:/usr/java/bin/
export JAVA_HOME=$JAVA_HOME:/usr/java/bin/java/

If still facing errors, take l0b0's advice (Problem with installing Android developer files on Eclipse - messed up something with .bashrc) to get new default .bashrc file, then try again adding those two lines.

-1

Edit you .bashrc file as follows:

export JAVA_HOME=/usr/java/
export PATH=$PATH:$JAVA_HOME/bin/ 

This assumes Java is installed in /usr/java.

2
  • There is a space still in the JAVA_HOME variable, it shouldn't be there.
    – Braiam
    May 9, 2014 at 0:37
  • Was is really necessary to downvote this comment several times? May 9, 2014 at 9:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .