Friday Oct 26, 2012

Apple's Java Mac OS X 2012-006 Update

The recent Java Mac OS X 2012-006 update from Apple removes the Apple Java 6 plug-in from your Mac. The Mac OS X Install FAQ will be updated with the next 7u release, but you may find the following information useful in the meantime.


Q: I have installed Java for OS X 2012-006 and Apple Java 6 can no longer be used for applets or Web Start. How do I get it back?

A: The Java for OS X 2012-006 update from Apple uninstalls the Apple-provided Java applet plug-in from all web browsers. You can download the latest version of Java from Oracle, which has improved security, reliability and compatibility.

If you prefer to continue using Apple's Java 6 plug-in, you can follow the steps provided in How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality.


Q: After installing Java for OS X 2012-006, can I continue to use Apple's Java 6 alongside the OS X JDK or JRE for Java 7?

A: If you want to continue to develop with Java 6 in a Terminal window you can modify the startup script for your favorite command environment. For bash, use this:

export JAVA_HOME=`/usr/libexec/java_home -v 1.6`

Some applications use /usr/bin/java to invoke Java. After installing Java for OS X 2012-006, /usr/bin/java will find the newest JDK installed, and will use that for all of the Java related command line tools in /usr/bin. You may need to modify those applications to find Java 6, or contact the developer for a newer version of the application.


Also, this update removes Apple provided Java Preferences app. For more information on how to determine the default version of Java on your system, see Determining the Installed Version of the JRE in the JRE 7 Installation for Mac OS X page.

Wednesday Oct 03, 2012

JavaOne 2012 - Java Deployment on Mac OS X

Also at the JavaOne 2012 conference, Scott Kovatch presented a session on Deploying Your Application with OpenJDK 7 on Mac OS X. The session had special emphasis on how to deploy Java applications to the Mac App Store. Interested developers may find the following documentation useful: Packaging a Java App for Distribution on a Mac.

The Java Deployment on Mac OS X presentation, by Scott Kovatch and Chris Bensen, provided an overview of Oracle Java on the Mac. For more information on installing and using Oracle Java for the Mac, refer to the following documentation:

From the Deploying Your Application with OpenJDK 7 on Mac OS X conference session page, you can watch the presentation or download the presentation slides.

From the Java Deployment on Mac OS X conference session page, you can watch the presentation.

Thursday Feb 18, 2010

Getting Java Applets to Work on Mac OS

Are you having trouble viewing some Java applets on a Mac? Got next generation Java Plug-in?[Read More]

Wednesday Sep 26, 2007

Popup Menus and the Mac OS

Today I was evaluating a demo that someone had graciously submitted for the tutorial. This demo features a good use of a popup menu but, for some reason, it wasn't working on my Mac. Here is a snippet of code from the demo. Can you see what's wrong?

    /\*\*
     \* Selects the closest path on a right click and bring up the operations menu.
     \*/
    private MouseAdapter treeMenuClicked = new MouseAdapter(){
        /\*\*
         \* @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
         \*/
        public void mouseClicked(MouseEvent e) {
            if(e.getButton() == MouseEvent.BUTTON3){
                int row = tree.getClosestRowForLocation(e.getX(), e.getY());
                tree.setSelectionPath(tree.getPathForRow(row));
                menu.show(tree, e.getX(), e.getY());
            }
        }
    };

You probably guessed that this is non-portable code. It's checking for "button 3" which my Mac mouse doesn't have. I'm happy to say that the How to Use Menus section of the Java Tutorial actually addresses this: replace the previous code with this code:

    private MouseAdapter treeMenuClicked = new PopupListener();
    
    class PopupListener extends MouseAdapter {
        public void mousePressed(MouseEvent e) {
            maybeShowPopup(e);
        }

        public void mouseReleased(MouseEvent e) {
            maybeShowPopup(e);
        }

        private void maybeShowPopup(MouseEvent e) {
            if (e.isPopupTrigger()) {
                int row = tree.getClosestRowForLocation(e.getX(), e.getY());
                tree.setSelectionPath(tree.getPathForRow(row));
                menu.show(tree, e.getX(), e.getY());
            }
        }
    }

Now I can bring up the popup menu on my Mac using Control-click. This example should now work on all platforms. (Though I can only test it on my Mac. Please let me know if it doesn't work for you!)

-- Sharon Zakhour

About

Blog about Java technology documentation and news about Java releases.

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today