Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
delete the last two lines from that file. –  Avinash Raj May 5 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 at 0:31

2 Answers 2

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.

share|improve this answer

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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