Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: How to change Java Home?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to change Java Home?




On Jun 23, 2008, at 6:59 PM, Kirk Mattson wrote:

(b) modify the "Java Home" link underneath OS X using UNIX commands. This is
one of the approaches that I would consider a hack because (unless someone
from Apple wants to chime in and tell us differently) Apple recommends
against it. One reason is that they will release system updates that change
it without you knowing it. For example, my "up-to-date" Leopard install
currently points to 1.5, but I suspect an update in the future will change
it to point to 1.6.

Ding, I think Pratik is from Apple.

I'm not sure what he suggested works though?
I made the change to my .bash_profile he suggested.
I added this to an ant build file.

	<property environment="env" />

	<target name="javac16">
		<echo message="JAVA_HOME	= ${env.JAVA_HOME}" />
		<exec executable="javac">
			<arg line="-version"/>
		</exec>
	</target>

When run I get this...

javac16:
[echo] JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/ Versions/1.6.0/Home
[exec] javac 1.5.0_13
[exec] javac: no source files
[exec] Usage: javac <options> <source files>


 Then all the usage stuff for some reason.

So it doesn't change the javac that is used?
That would seem to make sense given this setup for javac

which javac
/usr/bin/javac

ls -l /usr/bin/javac
lrwxr-xr-x 1 root wheel 78 Nov 16 2007 /usr/bin/javac -> /System/ Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/javac


which shows it completely dependent on what CurrentJDK links to, not a java home setting.

Maybe I should of looked at what Giuliano recommended for XCode, this might duplicate it.
But what appears to work for Terminal run Ant is...
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="on"
target="1.5"
source="1.5"
optimize="off"
fork="yes"
executable="/System/Library/Frameworks/JavaVM.framework/ Versions/1.6.0/Commands/javac"
includes="**">
<classpath refid="classpath"/>
</javac>


NOTE: The fork="yes" and executable="what it is"

From Javac Task
http://ant.apache.org/manual/CoreTasks/javac.html

Mike Hall        hallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: How to change Java Home? (From: Kirk Mattson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.