Apple Releases Java 1.4.1 for Mac OS X
by Daniel H. Steinberg03/10/2003
It has been a tough six months to be the Java on the Mac guy for O'Reilly Network. Like many of you, I've had the alpha, then beta developer previews of Java 1.4.1 for Mac OS X. On the one hand, this meant that we couldn't talk publicly about the new features or discuss the good and bad points of the release because anyone who downloaded the developer previews was under NDA. On the other hand, there was no point in writing more articles about Java 1.3.1 for the Mac because that bus is moving on.
The big news in this release, according to Apple Java Product Manager Allen Dennison, is "getting us up to date with the latest release of Java from Sun." Apple had two tasks in moving from the 1.3.1 version of Java to 1.4.1. First, there were 60 percent more classes from Sun in the 1.4 release. Second, Apple decided to do a major rewrite and clean up the technology underneath the release. The GUI was moved from Carbon to Cocoa. This decision was costly in terms of time, but means that Java applications look and feel more like native applications on Mac OS X.
The Download
The Java 1.4.1 release for Mac OS X is available from Apple using the Software Update. Check out the release notes, read the notes about QuickTime Java incompatibility, or just visit the Apple Java main page.
You may remember that Apple drew a line in the sand with the Java 1.3.1 release. They said that Java 2 would never be available on Mac OS 9 or earlier but that Mac OS X would ship with Java 1.3.1 included in every box. Similarly, Java 1.4.1 is available for download by all Jaguar users. As you'll see from some of the features described below, it is impractical for Apple to provide a Java 1.4.1 implementation for pre-Jaguar releases.
There are two important points to note in the availability of Java 1.4.1 to all Jaguar users. First, Apple has continued its commitment to providing a great Java implementation and widely distributing it on the platform. I can write a Java application and send it to my mom and know that she can run it on her iMac with my dad offering helpful advice like "just click on it." Second, for the first time, there will be two versions of Java available on the Mac. We haven't had to worry about more than one VM for a while. With this release, the Apple 1.4.1 JVM will be introduced while the 1.3.1 JVM so as not to break previously released Java applications.
The Rewrite
The Java 1.4.1 release represents a major rewrite on Apple's part. The infrastructure has been completely rewritten. Apple's Dennison explains that "To get Java 1.3.1 working on OS X we created 900 classes in addition to the 1,800 classes that were part of the J2SE base. With the rewrite we are maintaining only 300 classes to support the 3,000 classes that are part of J2SE. If you go back to Mac OS 9, the number of classes we've provided compared to the J2SE base has gone from 175 percent to 50 percent to the current 10 percent."
Apple explains that taking the extra time now with this rewrite will make keeping up with Sun releases much easier. Cynics might note that Sun released the beta of Java 1.4 almost two years ago and the final release one year ago. Apple has been a year behind Sun with most of its Java releases and promised to try for 60 days after Sun in future releases. Dennison makes no promises about the future, saying that the current release is more stable and feature rich and the benefits in reducing the time to port future releases remains to be seen but that the Java implementation on Mac OS X is in a great position to move forward.
The New Stuff
|
Related Reading
Mac OS X Hacks |
Dennison says that the new Java release is more closely aligned with Aqua and that, more generally, there is a tighter integration with Jaguar. For example, Java applications can take advantage of Quartz Extreme to get faster rendering for scrolling, faster window movement, and improved performance in transparency effects. As Quartz Extreme evolves, the performance of the Java GUI will improve as well. As another example, there is a better match between Java and Cocoa than there was between Java and the preemptive threading model of Carbon. For non-GUI applications, the Java threads have mapped to native Mach threads, but for GUI applications there has been a traditional mismatch between Java and Carbon. Much of the reduction in Apple's glue code has been eliminated because of this move from Carbon to Cocoa.
With Jaguar, Apple made a commitment to supporting the U.S. government's Section 508 Accessibility statute with its Universal Access features. These allow users to open up their system preferences and configure their Mac to take advantage of assistive technologies that help with seeing, hearing, and using the keyboard and/or mouse. The Apple Java team has built the Java Accessibility API on top of this Jaguar API. In addition, once you have the handles to the buttons and menus in a Java application necessary to enable the accessibility features, you can make those same handles available to the new AppleScript GUI Scripting. When you bring up a Java 1.4 application, you'll see the button hierarchies and so on, and can make calls into your Java application from AppleScript. In addition to making your Java applications AppleScriptable, this also provides a nice framework for doing GUI testing of your Java application.
The Niche
Where does Java fit with all of Apple's developer APIs. A quick look at the base Mac OS X install shows support for developing in Perl, Python, PHP, Ruby, C, C++, Objective-C, and Java. The amount of developer tools that come standard on the platform makes Mac OS X a natural choice for a development platform. Dennison advises that Java continues to be the right choice if you are considering a cross-platform application. If you're developing solely for Mac OS X, Java may not be your language of choice.
According to Dennison, "The days of providing specific Java APIs for Mac technologies are gone." This means if you want to make calls into native APIs you are going to have to use JNI as JDirect is going away. Looking at Apple's approach in the area of accessibility, the standard Java APIs will be used to call into the appropriate native technologies. You can't expect to see Apple releases of JavaBeans for the Speech and Spelling frameworks as in the past. There is no reason, however, that these wrappers can't be produced by third parties and made available.
Daniel H. Steinberg is the editor for the new series of Mac Developer titles for the Pragmatic Programmers. He writes feature articles for Apple's ADC web site and is a regular contributor to Mac Devcenter. He has presented at Apple's Worldwide Developer Conference, MacWorld, MacHack and other Mac developer conferences.
Read more Java Programming on the Mac columns.
Return to the Mac DevCenter.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 12 of 12.
-
java.swing not working in 1.4.1
2003-03-26 15:08:52 jzvogel [Reply | View]
I'm brand spannkin' new to programming (taking Intro to Programming Java with Park University this semester) and I've been unable to get the simplest of GUI programs working. Every attempt to utilize a class from javax.swing.*; results in errors. What am I missing? What am I doing wrong? I don't have the exact errors in front of me but they boil down to the javax.swing classes not being on my computer. I've read the 1.4.1 release notes and every other Java document I can get my hands on but it appears that the swing applications should still work under 1.4.1. I'm the lone Mac guy in a class of 20 and I want to use my Mac for the class. Any suggestions?
FYI -
PowerBook Pismo 400
OS X 10.2.4 (OS 9 not installed)
Java 1.4.1 update installed (& reinstalled)
Using terminal to compile and run java apps
I've already order the new O'Reilly book on Java Programming in OSX from Amazon and eagerly await it's release and arrival.
Thanks in advance.
Jody Vogel
macgeek2112@mac.com
-
Where is javax.swing in 1.4.1???
2003-03-26 15:04:17 anonymous2 [Reply | View]
I'm brand spannkin' new to programming (taking Intro to Programming Java with Park University this semester) and I've been unable to get the simplest of GUI programs working. Every attempt to utilize a class from javax.swing.*; results in errors. What am I missing? What am I doing wrong? I've read the 1.4.1 release notes and every other Java document I can get my hands on but it appears that the swing applications should still work under 1.4.1. I'm the lone Mac guy in a class of 20 and I want to use my Mac for the class. Any suggestions?
FYI -
PowerBook Pismo 400
OS X 10.2.4 (OS 9 not installed)
Java 1.4.1 update installed
Using terminal to compile and run java apps
I've already order the new O'Reilly book on Java Programming in OSX from Amazon and eagerly await it's release and arrival.
Thanks in advance.
Jody Vogel
macgeek2112@mac.com
-
UI Scripting
2003-03-16 23:57:15 anonymous2 [Reply | View]
This is very important becuase amongst other benefits, it opens the door to automated testing.
-
you can still use 1.3.1
2003-03-11 09:48:58 anonymous2 [Reply | View]
for those of you with broken applications (resin for instance), you can still use apple's 1.3.1 implementation. check in:
/System/Library/Frameworks/JavaVM.framework/Versions
you should find 1.4.1 as well as 1.3.1 there. Just edit your bootstrap scripts (for applications like jboss, resin) to point to the 1.3.1 jdk instead of the default, which points to 1.4.1).
-
Java 1.41 breaks Safari
2003-03-11 07:33:59 anonymous2 [Reply | View]
I installed Java 1.4.1 via software update and now wish I had not. Java quotes at island.com use to work great with Safari now they are garbled. Is there a way to remove Java 1.41 without wiping the drive clean?
Beware to all who install 1.41. Your Safari may not work right afterwards.
Michael
-
So how do you get it to work with Mozilla
2003-03-11 06:55:37 anonymous2 [Reply | View]
It is about time that they updated it, but the release notes don't tell you how to install it. Only Safari can get at it. I want Mozilla to use 1.4.1 and the 1.4.1 JVM and I'm having not luck.
-
MacOS Specific Java, or "what about cocoa?"
2003-03-10 22:17:39 anonymous2 [Reply | View]
"The days of providing specific Java APIs for Mac technologies are gone."
What does this mean? Apple will still support the Cocoa APIs in java, right? Since presumably all the cool Mac technologies are available through Cocoa, they should also be available to Java programmers who wish to write to them using the Cocoa classes.
-
GUI scripting is a long way from AppleScript
2003-03-10 21:39:56 bumppo [Reply | View]
When you bring up a Java 1.4 application, you'll see the button hierarchies and so on and can make calls into your Java application from AppleScript. In addition to making your Java applications AppleScriptable...
The difference between GUI scripting and AppleScript is the difference between screen-scraping HTML and a web services API wired up to business logic. Yes, the latter requires more work on the developer's part, but the former is a dreadful hack, sure to break the next time the scrape-victim trivially changes its spots.
AppleScript is not a macro language, so GUI-scrapable application is not an AppleScriptable application. I realize the distinction is a bit peripheral to Java (making a bona-fide Java app legitimately scriptable sounds like tilting at windmills) but for Mac developers, it's anything but. I have a lot of fear that we're going to see GUI scraping as an easy way to slap a "scriptable" label on halfassed applications.
-
It looks nicer, but consumes more memory and feels slower.
2003-03-10 19:11:00 anonymous2 [Reply | View]
JBuilder 7 takes 25% more memory and feels noticeably slower than before. Plus, the HTML documents in JBuilder Help used to be fine under 1.3.1, slightly broken after the first installation of 1.4.1 DP, and now it's totally invisible.
Also, "Toolkit.getDefaultToolkit().getFontList()" works fine under 1.3.1, but fails under all versions of 1.4.1 with "NullPointerException" originated within "sun.java2D.SunGraphicsEnvironment.getAvailableFontFamilyNames()".
.
-
resin is dead
2003-03-10 17:33:32 maarky [Reply | View]
I had resin installed as an apace module (I'm not sure which version, but an old one - 2.1.2 maybe) and after installing java 1.4.1 it doesn't work. Terminal says it is on, but jsp pages say "Can't contact servlet runner at localhost:6802" Strange. Also, I cannot compile version 2.8 because of various errors. Any ideas? It worked fine yesterday.






- Borland has finally released: JBuilder X Professional for Mac OS X. ( 10.2 and above )
( I've got my copy and it's, so far, the best IDE on OS X, IMHO ).
Do a price check on pricegrabber.com.
A bit pricey, but, it's the smoothest IDE on the Mac.
- Does XCode even run Java any more?
Apple seems to think the old doc for Project Builder still works in XCode, but, It doesn't. What's up with that?!?
If you can still develop Java in XCode, I'd like to see an article on that.
- Can't seem to get JDeveloper, from Oracle, for Mac any more?
We get a preview and then Nothing?!?
( Oh well, see JBuilder note above )