I've JDK 1.7 installed on my windows 7 machine and after installing JDK 1.8 u20 I'm having following error:
C:\>java -version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
My PATH variable points to the older version (i.e. 1.7).
What is wrong here and how I could use java 8 along with java 7?
The problem is that Java 8 installs a lot of stuff that you don't really need:
\windows\system32 contains Java 8 java.exe, javaw.exe and javaws.exe. Your path probably has system32 near the beginning, so these tend to be run by default.
The system path variable starts with C:\programdata\Oracle\Java\javapath. This folder contains java.exe, javaw.exe and javaws.exe as symlinks to the JRE 8 executables.
I've deleted the system32 files and removed C:\programdata\Oracle\Java\javapath from the system path. This seems to cure the problem. I can now switch versions by pointing JAVA_HOME and PATH to the appropriate folders.
Oracle, it seems, are determined to make it hard to run multiple versions. This is understandable with the JRE, but it's crazy with JDKs, as developers almost always need multiple versions of Java.
EDIT: I find this batch script is useful for switching JDKs. Usage: jdk.bat 6|7|8. You might have to edit the installation location for Java.
#echo off
if "%1"=="" goto report
set _version=%1
shift
if "%1"=="DBG" shift & echo on
set _command=%1 %2 %3 %4 %5
set _jdkdir=
set _jdkver=
for /D %%f in ("C:\Program Files\java\"jdk1.%_version%.*) do call :found "%%f"
if "%_jdkdir%"=="" goto notfound
set java_home=C:\Program Files\java\%_jdkdir%
call :javapath
path %new_path%
goto :report
:javapath
setlocal enabledelayedexpansion
set _jdirs=
for /D %%j in ("C:\Program Files\java\*") do set _jdirs=!_jdirs!#%%~fj\bin
set _jdirs=%_jdirs%#
set _javabin=%java_home%\bin
set _fpath="%PATH:;=" "%"
call :checkpath %_fpath%
endlocal & set new_path=%_javabin%
goto :eof
:checkpath
if _%1==_ goto :eof
echo %_jdirs% | find /i "#%~1#" 1>nul 2>&1
set _err=%errorlevel%
if not %_err%==0 set _javabin=%_javabin%;%~1
if %_err%==0 echo Removed %~1 from path
shift
goto :checkpath
:report
javac -version
%_command%
goto :eof
:notfound
echo No JDK matching [C:\Program Files\java\jdk1.%_version%.*] found.
goto :eof
:found
set _jdkdir=%~n1%~x1
for /F "tokens=2,3 delims=." %%a in ("%_jdkdir%") do set _jdkver=1.%%a.%%b
goto :eof
In the START menu type "regedit" to open the Registry editor
Go to "HKEY_LOCAL_MACHINE" on the left-hand side registry explorer/tree menu
Click "SOFTWARE" within the "HKEY_LOCAL_MACHINE" registries
Click "JavaSoft" within the "SOFTWARE" registries
Click "Java Runtime Environment" within the "JavaSoft" list of registries
here you can see different versions of installed java
Click "Java Runtime Environment"- On right hand side you will get 4-5 rows . Please select "CurrentVersion" and right Click( select modify option)
Change version to "1.7"
Now the magic has been completed
You can't have your cake and eat it too. :)
When you set your PATH variable to JDK 1.8, The problem should resolve. You can run your programs in JDK 1.7 by setting PATH manually using set PATH from command prompt or can go to the JDK 1.7 directory and run your program from there.
But there can be only one JDK in your PATH.
I had the same problem then realized my program was running out of c:\Windows\SysWOW64 and hence running the old java.exe. Once I stopped running out of that directory (which contains the Java 7 exe), the problem went away since it followed the path properly to java8.
If you are not comfortable to remove any files in Windows manually, just put your JAVA_HOME path in the front of Windows dirs.
Define JAVA_HOME environment variable in Windows 7 and use it in variable PATH on first position of Path variable.
JAVA_HOME -> D:\dev\Java\jdk1.8.0_45
Path -> %JAVA_HOME%\bin;%SystemRoot%\system32;
You could define a java7 alias that would lead to the bin folder of your JDK7, and then change your environment variable so that it points JDK8. The default JDK would then be JDK8.
Thanks #Chris, for me it was solved just deleting the files from C:\Windows\System32.
I got this problem when using the Sencha Command, but of course it has nothing to do with Sencha. It is a Java installation issue.
Apparantely this issue was also really annoying for people with Java 1.6 and 1.7 according to this post:
Registry Key '...' has value '1.7', but '1.6' is required. Java 1.7 is Installed and the Registry is Pointing to it
In my case, I uninstalled other versions of Java keeping Newer version
I had Java 7 and Java 8 in the system.
I Uninstalled 7 and kept 8, in the path, I already had Java 8.
It worked for me :)
This issue is annoying when dealing with multiple JDKs for developing on Windows 10 (I couldn't make use of the OS system path change as suggested here).
As a partial answer (since this might not be intended as 'properly' installed) I'm doing quite fine using Cygwin to switch JAVA_HOME and run Maven builds with different JDKs (1.7,1.8) installed (via Oracle installers).
So if you have Cygwin installed (or can install and use it) and willing to use JAVA_HOME env variable (useful with Maven as in this example below) you could do like this (BUT be aware of the 'trick' in the answer at link 1 and adjust your local paths accordingly):
export JAVA_HOME=/cygdrive/c/Progra~1/Java/jdk1.8.0_74
(mvn --version output)
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
2015-11-10T17:41:47+01:00) Maven home:
C:\Work2\bin\apache-maven-3.3.9-bin\apache-maven-3.3.9 Java version:
1.8.0_74, vendor: Oracle Corporation Java home: C:\Progra~1\Java\jdk1.8.0_74\jre Default locale: it_IT, platform
encoding: Cp1252 OS name: "windows 10", version: "10.0", arch:
"amd64", family: "dos"
export JAVA_HOME=/cygdrive/c/Work2/bin/Java/jdk1.7.0_79_64bit/
(mvn --version output)
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
2015-11-10T17:41:47+01:00) Maven home:
C:\Work2\bin\apache-maven-3.3.9-bin\apache-maven-3.3.9 Java version:
1.7.0_79, vendor: Oracle Corporation Java home: C:\Work2\bin\Java\jdk1.7.0_79_64bit\jre Default locale: it_IT,
platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3",
arch: "amd64", family: "windows"
https://stackoverflow.com/questions/14567191/export-java-home-with-spaces-in-cygwin
Edit this text in base your own values, save as ".reg", execute, enjoy :)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0_74]
"JavaHome"="C:\\Program Files\\Java\\jre8"
Related
I'm trying to get WSL to recognize my windows installed environmental variable of JAVA_HOME. I attached of what I have in my bashrc and what I have in my windows environmental variables along with outputs from cmd and bash.
What's at the end of my bashrc:
export JAVA_HOME="/mnt/d/Program Files/Java/jdk-11.0.1"
export PATH="/mnt/d/Program Files/Java/jdk-11.0.1/bin:$PATH"
CMD INPUT/OUTPUT:
C:\Users\jaall>javac --version
javac 11.0.1
BASH INPUT/OUTPUT:
myubuntu_name#DESKTOP-LUK3BII:~$ javac --version
Command 'javac' not found, but can be installed with:
sudo apt install default-jdk
sudo apt install openjdk-11-jdk-headless
sudo apt install ecj
sudo apt install openjdk-8-jdk-headless
I've been stuck on this for awhile and can't figure it out or find a working solution online. Thanks!
As Biswapriyo suggested, you should use WSLENV.
Open PowerShell. Then set JAVA_HOME to the path to your java installation.
In your case, run setx JAVA_HOME "D:\Program Files\Java\jdk-11.0.1"
You should see a message that says "SUCCESS: Specified value was saved".
Then run setx WSLENV "JAVA_HOME/p".
You should see the success message again.
Type 'env' into your WSL bash prompt.
You should see JAVA_HOME correctly set at this point.
Note: If step 2 doesn't work, you might want to changing the path to JAVA_HOME to include the \bin folder.
TL;DR: In WSL, you must use javac.exe since it is a Windows binary. Simply typing javac will not work, even if the path is set up correctly. If that doesn't work, try adding ../bin to the end of your JAVA_HOME variable.
Using Windows Binaries & Environment Variables in WSL
There's a much easier way to make Windows and WSL utilize the same JavaSDK binary, you just need to set up a few things first. Best of all, if you have JavaSDK installed on Windows, you do not need to install Linux binaries.
Check WSL Permissions and Directory Link (Optional, but recommended)
In WSL, list symbolic links on PC:
ls -l /mnt
If any drive is owned by root, perform your WSL dev work in /mnt/c/Users/<UserName>
Personally, I create a development directory in Windows and add a symbolic link to the directory in WSL:
ln -s /mnt/d/dev/environment/ ~/dev
cd dev now brings you to your development directory.
Ensure Java for Windows works
Open PowerShell/cmd.exe from any directory and enter: java --version
You should get a list of JRE info:
openjdk 11.0.4 2019-07-16 LTS
OpenJDK Runtime Environment Corretto-11.0.4.11.1 (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.4.11.1 (build 11.0.4+11-LTS, mixed mode)
Your version might be different, the important part is that the system knows where to find Java. If you get an error, ensure your Windows Environment variables are set correctly:
JAVA_HOME as an Environment Variable, and
JAVA_HOME/bin as a Path variable.
Setting Variable in WSL
The best place to put the next lines of code are in your .bashrc file, but if you have a ./bash_profile or /etc/profile structure set up, you can put it there.
# Shared environment variables
# Use 'java.exe <args>' to utilize Windows Java binaries from within WSL.
export JAVA_HOME=/mnt/d/Java/jdk11.0.4_10
While we're at it, let's add Maven too:
export MAVEN_HOME=/mnt/d/software/apache-maven-3.6.2
I have my WSL, Java, and all my other dev tools set up on my second HDD which is not a system drive, ensure that your location matches your JAVA_HOME path in Windows.
For instance, if in Windows, Java is located at: C:\Java\jdk8.0
The corresponding WSL mount point is: /mnt/c/Java/jdk8.0
Executing
Important: Use java.exe <args> in WSL instead of java <args>
Say you just wrote CompareTwoStrings.class and want to compile and run it using the Windows binaries. You can do it from a Windows shell or WSL.
Windows PowerShell/cmd:
javac GetStringLength.java
java GetStringLength
WSL:
javac.exe GetStringLength.java
java.exe GetStringLength
Using java <args> in WSL will result in a Command 'java' not found error. That is because running windows binaries from within WSL requires that the .exe extension is used in the command.
Simplicity
We don't want to install a second copy of Java specific to WSL and waste that precious disk space, so we're going to call the Windows binary from the WSL shell. This is a great benefit of WSL—WSL1 in particular—in that it can interact (almost) flawlessly with the Windows File System.
NOTE: In order to run a program, it must either be a Path variable, or be run from within it's containing folder.
Hopefully that works as easily for you as it did for me. Just remember to use the correct command depending on what OS binary you're running. This took me about 10 minutes to get set up, and has been a lifesaver for cross-compiling and general ease-of-use.
I originally had Maven working in Windows attempted to run Maven in WSL2 and tried all of the previous solutions, but would consistently get the following no matter what I set for JAVA_HOME and PATH:
$ mvn -v
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
The issue was I was trying to use a Windows version of the JDK in the WSL2 Linux kernel. To fix this I ended up having to install a Linux version of the JDK (version 11) in the WSL as follows:
$ sudo apt update
$ sudo apt install openjdk-11-jdk
$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/bin/java
Nothing to configure.
Then take the path for your JDK and use it to create JAVA_HOME and update PATH by appending the following in .profile
export PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin/java:$PATH"
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
Now close and reopen WSL2 and when your try again:
$ mvn -v
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.13, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.10.16.3-microsoft-standard-wsl2", arch: "amd64", family: "unix"
Since I've never been able to share variables between the 2 systems easily, I created a simple bash function which can easily retrieve (and define, if asked to) any Windows Environment variable.
It also takes care of paths so they get converted from Win32 to Un*x-like.
I added this to /etc/bash.bashrc:
winenv()
{
if [ "$#" == "0" ] || [ "$1" == "--help" ]
then
echo $'\n'Usage:
echo $'\t'winenv [-d] WINDOWS_ENVIRONEMENT_VARIABLE_NAME
echo $'\t'-d: Defines environment variable in current shell
echo $'\t Note that paths will be translated into un*x-like\n'
return
fi
local IFS='$\n'
local PATH_TO_TRANSLATE=$1
[ "$1" == "-d" ] && PATH_TO_TRANSLATE=$2
local VAR=$(cmd.exe /c echo %${PATH_TO_TRANSLATE}% | tr -d '\r')
local NEW=$(wslpath -u "${VAR}" 2>/dev/null || echo ${VAR})
echo "${PATH_TO_TRANSLATE} = ${VAR} -> ${NEW}"
[ "$1" == "-d" ] && export "${PATH_TO_TRANSLATE}=${NEW}"
}
And all I have to do to display one is to call winenv PROGRAMFILES (for example)
Or if I expect to export it, I just have to add a -d argument before the variable name as in winenv -d WINDIR.
I installed JDK and set up Maven. Call of mvn -version i get returns:
The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE
$JAVA_HOME variable is set to C:\Program Files\Java\jdk1.8.0_131\bin in system variables.
Call of %JAVA_HOME% returns path C:\Program Files\Java\jdk1.8.0_131\bin.
Where is the problem?
As you can see in the documentation the JAVA_HOME variable must point to the java installation path, not to the bin folder.
Change it to C:\Program Files\Java\jdk1.8.0_131
The question is about Windows but I came here trying to solve the problem on Ubuntu.
I faced a similar problem. I configured $JAVA_HOME in /etc/environment
like $JAVA_HOME=PATH_TO_JDK for example $JAVA_HOME=/home/max/jdk1.8.0_144
Careful with
White space after path declaration $JAVA_HOME=/home/max/jdk1.8.0_144[[_NO_WHITE_SPACE_AFTER_DECLARATION]]
Don't put any double apostrophe $JAVA_HOME="/home/max/jdk1.8.0_144"
Don't put /bin e.g $JAVA_HOME=/home/max/jdk1.8.0_144/bin <- This is wrong
Yes, original question is about pure windows, but for those who came here wondering about windows linux subsystem WSL, I stumbled across the thing trying to set up my win WSL, to use windows java Open jdk binaries. Though in a while i gave up on that idea. Installed jdk with 'sudo apt install ...' and then set WSL java home from installed path:
root#mypc://# java -version
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0+deb9u1-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
root#mypc://# which java
/usr/bin/java
root#mypc://# realpath /usr/bin/java
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
use yours realpath instead.
root#mypc://# export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
root#mypc://# mvn -v
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T15:06:16Z)
Maven home: /mnt/c/javaDir/mvn/apache-maven-3.6.2
Java version: 1.8.0_265, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-43-microsoft", arch: "amd64", family: "unix"
add export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 to a ~/.bash_profile for this being set every time linux subsystem is lunched.
I am trying to install some software (Shibboleth) in Ubuntu 14.04. I already have Java 7 OpenJDK installed in /usr/lib/jvm/, and I have these lines in /usr/environment
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
export JAVA_HOME
If I type echo $JAVA_HOME I correctly get /usr/lib/jvm/java-7-openjdk-amd64.
However, when I try to install Shibboleth I always get Error: JAVA_HOME is not defined correctly. Cannot execute java.
Interestingly, if I type java command it works (it refers to /usr/lib/java which is a link to the right one). However, when I try to run bash bin/install.sh of Shibboleth, I get the JAVA_HOME error
I already tried setting JAVA_HOME to the jre folder with same result. Any ideas?
Add both JAVA_HOME & PATH to your ~/.profile
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
And, add following to your /etc/profile.d/java.sh
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JAVA_HOME
PATH=${JAVA_HOME}/bin:${PATH}
export PATH
JRE_HOME=/usr/lib/jvm/jre
export JRE_HOME
JAVA_OPTS="-XX:+AggressiveOpts -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
export JAVA_OPTS
For more info, Refer Documentation
Hope it helps.
Instead of
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
I did
EXPORT JAVA_HOME='/usr/lib/jvm/java-1.7.0-openjdk-amd64'
Works.
from Ubantu terminal execute:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
to test maven run:
mvn --version
it will give output:
Maven home: /usr/share/maven
Java version: 1.7.x.xxx, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-47-generic", arch: "amd64", family: "unix"
According to Your editor.
sudo vim /etc/profile
add these 2 lines at the end of the file
export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
export PATH=JAVA_HOME/bin:$PATH
Then
source /etc/profile
Check
mvn -version
you should set the path to bin folder where java, javac files are found.
In your case it might be /usr/lib/jvm/java-7-openjdk-amd64/bin
I issue is that the install.sh script which you are running has the java path wrong.
Edit the file using nano
sudo nano idp-install.sh
or vim editor
vim idp-install.sh
and change the line which corresponds to java path and add the correct java path. This will solve your problem.
P.S. This solution is specific to the java path for Shibboleth installation.
For future comers, please note this problem usually happens because Java is not properly set in your environment. Take the following steps to fix the problem
first, check where your JDK is using the following command
cd /usr/lib/jvm/{jdk-version}
Now that you have the full path where your JDK is, copy the whole path like so, in my case I have jdk1.8.0_261
So you copy /usr/lib/jvm/jdk1.8.0_261 path, open /etc/environment and set the JDK path properly as follows
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:usr/lib/jvm/jdk1.8.0_261:/opt/apache-maven-3.6>
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_261
M2_HOME="/opt/apache-maven-3.6.3"
Note that I have added the /usr/lib/jvm/jdk1.8.0_261 to the PATH variable and also to the JAVA_HOME variable,
This should resolve the error Error: JAVA_HOME is not defined correctly. Cannot execute java since the JDK is now properly set in the PATH and in the JAVA_HOME, then for the Shibboleth you can also now define the path where it is installed like so (This is an example- don't know how to set Shibboleth)
SHIBBOLETH_HOME="/opt/shibboleth-{version}"
I'm trying to update my JVM and downloaded the dmg from java.com and installed it and now I see java has been updated to 1.7.0_55, but for some reasons /usr/libexec/java_home -v 1.7 doesn't return the new jdk but the old one (native to OS X).
chienandalusialocal:TempEc ngw$ /usr/libexec/java_home -v 1.7
Unable to find any JVMs matching version "1.7".
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
How should I fix this? Shouldn't the installer configure a working environment?
TIA,
ngw
You need to update your JAVA_HOME enviroment variable to point at the JVM you want to use; In factory distributions of OSX, the JAVA_HOME (specified in your ~/.bash_profile) will point to the JDK 1.6.0 installed in /System/Library/Java/JavaVirtualMachines
A simple fix; You need to change the JAVA_HOME variable at login, so you need to change a line in the text file ~/.bash_profile, which is run whenever you login.
In terminal:
type: open /Library/Java/JavaVirtualMachines to open Finder in the location of your JVMs. Get the folder name of the JVM you want to use, and save that for later.
type: open -a TextEdit ~/.bash_profile, and the file will open in TextEdit.
look for a line that says:
export JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" or
JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
export JAVA_HOME
and change to
export JAVA_HOME="/Library/Java/JavaVirtualMachines/YOUR_JDK/Contents/Home"
where YOUR_JDK is the folder name of the JVM you want to use that you found earlier.
Restart terminal to test the effects, and type java -V to see if it is working.
See https://superuser.com/questions/490425/how-do-i-switch-between-java-7-and-java-6-on-os-x-10-8-2
Trying to get Maven, Java, and OS X to play nice together - something I've done multiple times without issue on Linux and Windows machines. I assumed all I needed to do was download Maven, setup my environment variables and I'd be good. So here's a snippet from my .bash_profile...
export JAVA_HOME=/Library/Java/Home/
export M2_HOME=/usr/local/apache-maven/apache-maven-2.2.1
export PATH=$PATH:$M2_HOME/bin
The JAVA_HOME setting is what Apple recommends be used on this Q&A page. Yet after launching a terminal and running mvn --version, here's the output...
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.6.0_17
Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x" version: "10.6.2" arch: "x86_64" Family: "mac"
Any idea why the JAVA_HOME I'm setting in my .bash_profile is being ignored by Maven? It's causing problems because things like rt.jar aren't found in the JAVA_HOME Maven is using. I can work around this by creating symbolic links and other hackery in the home Maven is using, but I'd rather have it work correctly since this will just blow up on me the next time Apple pushes a Java update. Thanks for any help...
The problem is that the symbolic link "CurrentJDK" inside the versions of JavaVm.framework points to the old jdk, so when i used the following commands to set the CurrentJDK to the latest one (1.7.0_45) it works
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm CurrentJDK
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents CurrentJDK
reference:
http://java.dzone.com/articles/installing-jdk-7-mac-os-x
On Mac OS X, you should use /usr/libexec/java_home to determine the correct JAVA_HOME.
See What should I set JAVA_HOME to on OSX
On my Mac, /Library/Java/Home is a symlink (actually the start of a chain of symlinks) that ultimately points to /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home. So I don't think maven is ignoring anything. It's just giving you the actual location.
I have the same setup and all works fine. UNSET the "JAVA_HOME" environment variable in your shell script. The Mac install takes care of that. You are setting it wrong anyways.
Unset it, source your file or startup shell and try again.
well the first thing I would check is whether mvn is a script. If it is you can see how it's sourcing the environment. If it isn't I would look for any config files typically named .mvnrc, or something in /etc. Of course it wouldn't hurt to RTFM!