0

I was trying to install Angularjs through the Ubuntu terminal and to have proper install, I'd to change the path. Maybe during these time I've messed up with the path. After this, when I'm starting Ubuntu terminal, I'm always getting these three message at top of the terminal window:

bash: export: `/usr/bin/java': not a valid identifier
bash: export: `/usr/share/java': not a valid identifier
bash: export: `/usr/share/man/man1/java.1.gz': not a valid identifier

I've tried to find the solution in few forums excluding this, but couldn't solve it. I've followed this this post but it couldn't change anything.

My Java is working properly, I can open this command with a warning sudo gedit ~/.bashrc

What should I do to fix the problem?

Edition: After running I'm getting this command grep export ~/.bashrc, output:

#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export JAVA_HOME= /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz 
export PATH=$JAVA_HOME/bin:$PATH 

closed as unclear what you're asking by Rui F Ribeiro, Jeff Schaller, roaima, Isaac, Timothy Martin Jun 4 '18 at 19:42

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Please add the (formatted) output of grep export ~/.bashrc to your question. – roaima Jun 3 '18 at 0:15
  • 2
    Also, never run sudo gedit ~/.bashrc! You own your bashrc there is no reason to ever edit it as root. What warning are you getting? – terdon Jun 3 '18 at 0:23
  • The lines should look like export VAR=value - make sure there are no blanks around the = – Mark Plotnick Jun 3 '18 at 0:40
  • Thanks everyone for quick answer. I'm sorry late reply. @roaima, I've edited the question and put output 'grep export ~/.bashrc'. – Mamun Jun 3 '18 at 22:19
1

Your first export line wrongly contains a space after the assignment operator (=).

It also contains three values where, to my knowledge, JAVA_HOME only accepts one value: the location of the Java HOME directory.

export JAVA_HOME="/usr/share/java"
export PATH="$JAVA_HOME/bin:$PATH"
  • Here is how look Java path in my machine. export JAVA_HOME= /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz export PATH=$JAVA_HOME/bin:$PATH – Mamun Jun 3 '18 at 22:22
  • Sorry, that path was from .bshrc file. – Mamun Jun 3 '18 at 22:30
  • Surprisingly, in bashrc' file after commenting this line #export JAVA_HOME= "/usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz" and left alone this line export PATH=$JAVA_HOME/bin:$PATH , in terminal window the bash: export: “path” not a valid identifier no longer is being showed. Does it mean that the problem is solved? Or is it like I've made another mess up? – Mamun Jun 3 '18 at 22:34
  • @Mamun : In addition to what roaima said, you also have spaces in between the directory names! I strongly suggest that you try first your export statements on the commandline, before putting them into your .bashrc. – user1934428 Jun 4 '18 at 5:09
  • @Mamum commenting out the invalid line would also work, but then you're not setting any value for JAVA_HOME. Without that your Java-based programs won't work. And since it's now not set you should comment the second line too, which references it. – roaima Jun 4 '18 at 7:12

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