aspose file tools*
The moose likes Linux / UNIX and the fly likes Problems with Java Home in VMBox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Problems with Java Home in VMBox" Watch "Problems with Java Home in VMBox" New topic
Author

Problems with Java Home in VMBox

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

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?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

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.

[My Blog] [JavaRanch Journal]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

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


JBoss In Action
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

Looks like I need to get my eyes checked. Thanks for pointing out the typo.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

And then the next problem: Setting Maven Home



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



Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9427
    
    2

Changed my Java Home like Peter mentioned above and then everything started to work fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with Java Home in VMBox