Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Lyle

macrumors 68000
Original poster
Jun 11, 2003
1,874
1
Madison, Alabama
I've just downloaded the new Java SE 6 package and was going through the process of rebuilding various libraries and applications to see if anything broke. Looks like something did:

Code:
import java.sql.SQLException;

try {
    ...
} catch (SQLException ex) {
    throw new SQLException("message", ex);
}
This is (an abbrieviated form of) code which compiled fine under Java 5. The compiler is complaining that there's no such constructor for SQLException:

Code:
[javac] filename.java: cannot find symbol
[javac] symbol  : constructor SQLException(java.lang.String,java.sql.SQLException)
[javac] location: class java.sql.SQLException
[javac]             throw new SQLException("Unable to retrieve dates", e);
Is this a known problem?
 

Lyle

macrumors 68000
Original poster
Jun 11, 2003
1,874
1
Madison, Alabama
OK, so it appears to be a problem with Ant and not with Java per se. That is, Ant is still looking at my Java 1.5 installation even though the links have been updated to point to Java 1.6. More on this story as it develops.
 

RaceTripper

macrumors 68030
May 29, 2007
2,883
191
OK, so it appears to be a problem with Ant and not with Java per se. That is, Ant is still looking at my Java 1.5 installation even though the links have been updated to point to Java 1.6. More on this story as it develops.

Ant expects you to have a JAVA_HOME environment variable. Maybe you need to change that to point to the right JDK.
 

Lyle

macrumors 68000
Original poster
Jun 11, 2003
1,874
1
Madison, Alabama
Ant expects you to have a JAVA_HOME environment variable. Maybe you need to change that to point to the right JDK.
Yep, that was it. Well, actually, JAVA_HOME was defined:
Code:
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
but the problem is that when you install Java SE 6, even if you use the "Java Preferences" utility to change which runtime you want to use, it doesn't update the link for the "CurrentJDK" to point to the 1.6 JDK, and that's what was breaking things. To work around it, I just did this:
Code:
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm CurrentJDK
sudo ln -s 1.6 CurrentJDK
Now my code compiles without errors.
 

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, NC
The Java Preferences is for Applet and Application runtime selection.

The new update won't change the default command line version of java as you found out. This is also mentioned in the Release Notes

This release does not change the default version of Java. This release is only for Mac OS X v10.5.2 and later, and should not be installed on earlier versions of Mac OS X. This release is for 64-bit Intel-based Macs only and cannot run on PowerPC-based or 32-bit Intel-based Macs.

What really stinks is I can't install this update - now its officially time for a new MBP.
 

m3the01

macrumors member
Jun 18, 2007
70
0
Anyway to get jdk 1.6 to show up in xcode?

I tried the link command, but no luck.

Thanks
 

m3the01

macrumors member
Jun 18, 2007
70
0
I can compile and run everything using 1.6 however i cant get it to show up in xcode as a compile option.

Ive reverted to commenting out the 1.6 code in xcode and for production testing i add it back in and manually compile through the terminal using
/System/Library/Frameworks/JavaVM.framework/Versions/CurrenDK/Home/bin/javac

and run it with,
/System/Library/Frameworks/JavaVM.framework/Versions/CurrenDK/Home/bin/java


Work great,

If anyone knows a simple way to update the compiler in xcode to include the 1.6 javac lmk.

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.