Thursday, March 20, 2014

Java Fail on Old Mac

While working on the last assignment for my Java class, a Hangman game, I got the following error on this bit of code:

switch(menuText)
{
case "new game":
resetGame();
break;
case "quit":
//quit, how?
break;
default:
//it has to be a letter
revealLetters(menuText);
break;

}

Cannot switch on a value of type String for source level below 1.7. Only convertible int values or enum variables are permitted

Unfortunately, the suggested fix broke EVERYTHING. 

A little reading on Java's website revealed this:

        Mac OS X Version 10.6 and below
Use Software Update available on the Apple menu to check that you have the most up-to-date version of Java 6 for your Mac. Java 7 is not supported by these older versions of Mac OS X. If you have problems with Java 6, contact Apple Technical Support. Java.com does not provide a download for these systems.
Indeed I have OS X 10.6.8 and can't upgrade my old Mini any farther. I guess I'm headed off to school early today to finish up in the computer lab.