Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with Java Home in VMBox

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I have some trobles in getting Java Home to work on my VMBox that has Ubuntu. Following is what I have on my /etc/profile and /etc/bash.bashrc



When I say javac on a terminal, below is what I get.


I checked with my Ubuntu dual boot partition and there it seems to work fine for the same settings in /etc/profile but why not here on the VMBox?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
export JAVA_HOME=/opt/Softwares/jdk1.6.0_21/bin/java
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/Softwares/jdk1.6.0.21/bin


These 2 lines contradict each other. One refers to jdk1.6.0_21 folder and the other to jdk1.6.0.21 (note the . instead of _). Looks like a typo in those files. You'll have to fix it to point to the correct location.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, JAVA_HOME should be set to the installation directory, not to the location of the java executable:

export JAVA_HOME=/opt/Softwares/jdk1.6.0_21

Then when setting the PATH, never reset it, just add the new value. Also, use the prior env vars:

export PATH=$PATH:$JAVA_HOME/bin
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like I need to get my eyes checked. Thanks for pointing out the typo.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And then the next problem: Setting Maven Home



And this is what I get when I say mvn --version



 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Changed my Java Home like Peter mentioned above and then everything started to work fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic