This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
If you get the beta version of Mac OSX Tiger, it currently does come with Java 1.5 (Java 5), and people I know are using it. I'm getting ready to join the Apple Developer Network so that I can get the Mac Tiger beta, to start playing with it. The rumor is that both the OS Tiger and Java Tiger on the Mac are quite stable. One of our co-authors has permanently switched his Mac to the Tiger beta, and says it's been better for him than previous final releases of Jaguar, for example. Java 1.5 is DEFINITELY a part of the Max OSX Tiger, but I don't think Apple is planning to release Java 1.5 *before* they release the Tiger OS. So, far as I know, the only way to get 1.5 on the Mac is to get the beta of the OS.
Stephen, what I've heard is that it will be released first quarter of 2005, around March.
"Mejor morir de pie que vivir toda la vida arrodillas."<br /> Emilio Zapata
Cowgirl and Author
Joined: Oct 10, 2002
OK, it *is* possible now to run Java 1.5 on Panther...
A little bird told me that if you simply copy the Java binaries from a 10.4 (Tiger) machine directly onto your 10.3 (Panther) machine, it'll work. So that means one would have to be able to access a machine with 10.4, in order to get the actual JDK files (the stuff that goes in /System/Library/Frameworks/JavaVM.Framework/Versions (I think that's the path...)
And let's just say that I have seen it work with my own two eyes
Yes, you can be happily compiling and running the Apple beta of Java 1.5/5.0 on Panther. [I'm pretty sure it doesn't have any graphics support at this point, but who cares... you're probably only interested in trying out the new language features.]
Of course this is extremely unofficial, and it's not like *I* would actually do anything like this.
But I did happen to *see* someone do this and it indeed worked
It is possible (although currently still unlikley) that Apple will make it available as an unofficial, unsupported download for Panther. People are talking about it, but I would not hold my breath on that.
.bash_profile is a shell script that is executed when a bash shell logs in (which happens every time you open a Terminal window). You can use it to set up aliases, environment varaibles, and other useful things.
It "lives" in your home folder.
Be aware that (by default) files beginning with a dot are considered hidden and will not show up in Finder.
When you open Terminal, its working folder should be your home folder, which is where your .bash_profile should be. But if you haven't already created a .bash_profile, then you might not have one. So first, to ensure the file exists, enter the following in Terminal...
This will create the file if it doesn't already exist. (If it does exist, this will just update the time-stamp.) Next, use the following command to open the file in TextEdit...
After you've modified and saved the file in TextEdit, then make sure the file has the proper permissions by entering the following in Terminal...
(See Wikipedia - touch and chmod.) [ August 21, 2006: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Remember, Java is case sensitive. So your import statement needs an uppercase 'S' in "Scanner."
If it still doesn't work after fixing this, then we should verify that you are actually compiling with Java 1.5. At the prompt in Terminal, type "javac -version" (without the quotes). You will get a long error message because you didn't specify a file to compile, but it should start by telling you the version...
...javac -version javac 1.5.0_06 javac: no source files... [ August 21, 2006: Message edited by: marc weber ]
Did you update your .bash_profile as indicated above?
I'm not familiar with OS 10.3, so maybe you should wait for someone more Mac-savvy to confirm this. (Bear?) But if your Java Frameworks are set up like they are in 10.4, then there is a "CurrentJDK" alias under /System/Library/Frameworks/JavaVM.framework/Versions. This alias points to the folder of the "current" Java version. If have have this alias, then you should probably update it to point to the 1.5 folder as follows:
Identify yourself as the administrator by typing: sudo su root
Terminal will prompt for the admin password. Enter this.
Change the current directory by typing: cd /System/Library/Frameworks/JavaVM.framework/Versions
Within this directory, there is an alias called CurrentJDK pointing to the "current" version of Java. You need to remove this alias by typing: rm CurrentJDK
Now you need to replace it with a new alias pointing to the 1.5.0 directory instead. Do this by typing: ln �s 1.5.0 CurrentJDK
Finally, log out of the session as administrator by typing: exit
[ August 22, 2006: Message edited by: marc weber ]
Originally posted by John Davis: In Terminal can I compile java?
Absolutely! That's what the javac (java compiler) command is for. Use the cd command to change directories to the folder that contains your .java file, then compile with javac, and run with java (java runtime). Note that to compile a java file with the javac command, you include the ".java" extension -- but to run a class file with the java command, you do not include the ".class" extension. For example, if MyFile.java was under java/tests, then the Terminal commands would be...
If you followed the instructions for changing the CurrentJDK alias to point to the 1.5.0 folder, then you should be set for compiling and running in 1.5 via Terminal. Repeat the "javac -version" test above and see what you get now.
NetBeans will probably still need some additional configuration to use 1.5. For that, you might have better luck in the IDE forum. However, because you're trying to run Java 1.5 on Mac OS X 10.3 (which reportedly works, but isn't "official"), I think you should make sure Java 1.5 is working okay through Terminal before trying to get an IDE to work with it.
Your home folder. That'd be /Users/whatever, where whatever is your login name, in the Finder. Or ~ (yes, tilde) in a Terminal window -- that's where your current directory will be set upon opening a Terminal instance.
Be aware that hidden files that begin with . are not visible in the Finder.