You can run Java apps in two ways. The first is to run Java applets inside your Web browser with a plug-in. The second is to run native Java apps on your Mac. With the grave security concerns about Java these days, you may be thinking about how to remove or disable both of those Java systems completely from your Mac. This how-to discusses procedures to uninstall/disable both the plug-in ahd the full Java system. It also looks at the differences between Java 6 and Java 7.

1. Java Applets & Plug-ins

Many Mac users retain the ability to run Java applets in their browser with abrowser plug-in. Oracle now maintains that plug-in for Mac users. If you, because of recent security alerts, upgraded that plug-in to Java 1.7 (or "Java 7" in Java-speak) from Oracle, you'll find the plug-in in /Library/Internet Plug-ins. The file is "JavaAppletPlugin.plugin" and has the icon shown on the left.

Also, when you installed Oracle's Java 7 browser plug-in, you installed a Preference Pane in System Preferences under "Other."

Fig 1. Oracle's Java Preference Pane

That Preference Pane manages the Oracle Java 7 browser plug-in for applets. It will auto-detect that a new version is available, but it will not do the installation. You need to do that yourself under the Update tab.

Fig 2. The Update Tab. Available updates will be presented.

Java 7 won't run in Chrome because Chrome is 32-bit and Java 7 is 64-bit. That leaves Safari and Firefox as the remaining major Mac browsers.

Disabling the Browser Plug-in

The best way to block the applet plug-in in /Library/Internet Plug-ins for both Safari and Firefox browsers is to disable it in the Java Preference Pane. Uncheck the box circled below and restart your browser.

Fig 3. Disable Java for browsers.

By the way, you can verify which version is installed by looking at the Java tab and select "View..."

Fig 4. Verify the plug-in version.

You can also dig down into the plug-in with the terminal app and extract the version number.

> /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version

I showed this command not to be geeky but to reveal the structure of Oracle's Java applet plug-in. You can do that your self by using "Show Package Contents" on the plug-in.

Alternatively, to be really safe, you could delete the file: "JavaAppletPlugin.plugin" in /Library/Internet Plug-ins. But that would make it harder to easily re-enable the plug-in if you ever need it.

Most of the security issues reported so far relate to this Java applet plug-in for browsers because it is the vehicle through which maliciously crafted websites work.

Apple stopped providing its own Java browser plug-in in October, 2012 and a subsequent Software Update deleted it. Oracle has assumed responsibility for the Java applet plug-in since then.

Finally, you can test whether your Java plug-in has been disabled by going to Oracle's Java applet test page: http://www,java.com/en/download/testjava.jsp . (Safari and Firefox may respond slightly differently.) Only if your plug-in is up to date, enabled and working properly, will you see this:

Java browser plug-in up to date and working properly.

2. Java Applications and Java 6

Depending on the history of your Mac, you may still have Java 1.6 (or "Java 6" in Java-speak) installed for both development and native Java applications. Java 6 is a full-fledged development system that allows developers to write and you run full Java applications such as CrashPlan or jEdit. Apple, not Oracle, still maintains Java 6 for OS X based on patches provided by Oracle. (However, Oracle seems ready to stop issuing those updates for non-corporate users.)

The Two Different Java Systems

This is what confuses many users. They know they upgraded the applet plug-in for the browser, but the terminal command "java -version" doesn't refer to the plug-in. It shows you the version of Apple's full Java 6 package for development and native apps. They may have different version numbers.

Snow Leopard

Up through OS X 10.6, Snow Leopard*, Apple provided Java 6 pre-installed, and they still maintain it. The latest version is 1.6.0_43. If you've kept your system up to date with Apple Software updates, and you open a terminal window and type "java -version" (without the quotes), you should see this:

Fig 5. Getting the Java 6 version number.

I'll get to how to disable that Java install further down.

Lion & Mountain Lion

If you bought a new Mac with Lion or Mountain Lion pre-installed, Java 6 is not there. It's an optional install nowadays.

If you upgraded a Snow Leopard Mac to Lion and/or Mountain Lion, I believe that the install process suppressed Java 6 without a complete uninstall. From looking at my two Macs, it appears that the upgrade removed the directory/folder: /System/Library/Java/JavaVirtualMachines. That will stop any Java application cold in is tracks from running.

On such a Mac, if you enter "java -version" you'll get a prompt inviting you to install Java 6, like this:

Fig 6. Invitation to install Java 6

Or perhaps you installed Java 6 in order to run an older version of GoToMeeting. Or an Adobe installer may have done it.

After a Java 6 installation, there is a large collection of Java files is deeply embedded into OS X, and, unlike the simple plug-in for the browser, it's not easy to uninstall all those files. And no formal uninstaller exists. Matthew Dornquast of Code42 Software told me that the only SAFE way to remove all vestiges of Java 6 is to conduct a clean install of 10.8. And from then on, say "no" if ever asked to install Java.

Is Java 6 Installed?

To see if Java 6 is installed, on the command line, enter, after the prompt:

> java -version

If you see the invitation to install Java 6, shown in Fig. 6, you don't have an operational Java system for applications. (Recommended response: "Not now.") If you see a result like I showed in Fig 5, then it should be Java 1.6.0_43 (as of this writing.)

Uninstalling Java 6

Various websites and forum commenters have suggested a few tricky ways, from the command line, to partially uninstall Java 6 by deleting certain directories or files. There are several serious problems with deleting specific Java 6 files:

  1. Java 6 isn't really, completely uninstalled.
  2. Some applications or suites, for example from Adobe, depend on Java being on the Mac in that form. If you munge about, deleting key Java files, all kinds of unexplainable things might happen down the road.
  3. It's hard to re-enable Java for full applications if you need it unless you have very accurate notes on those files you deleted (or renamed). Believe me.
  4. Some of those examples use the diabolically dangerous "rm -rf" shell command, which if misunderstood and mistyped or misused, could damage your Mac and require you to reinstall OS X.

The best advice I have is to keep your Java 6 up to date and secure using the OS X Software Update function. After a period of inattention, Apple is being much more aggressive in keeping Java 6 up to date and secure. At some point in the future, you'll buy a new Mac with OS X 10.8 or 10.9 installed, and your Mac will be 100 percent free of Java 6. For now, if you're concerned about native Java apps that access websites, just don't run them.

Note that on a Mac without Java 6, you could still install Oracle's browser plug-in as described above.

3. Java Applications and Java 7 JDK

If you, because of security alerts, somewhere along the line, installed Oracle's Java 7 Development Kit (JDK), then entering the command "java -version" will reflect that Oracle's Java 7 has been installed for development. However, Apple's Java 6 is not deleted, (they can co-exist) and as I wrote here, "What Mac Users Need to Know About the Java Security Update":

More importantly, unless you know what you're doing with Java development, [installing Java 7 JDK] could break any stand-alone Java 6 apps you may have been using that depend on knowing where to find Java 6. (Most Java apps for the Mac have been written in Java 6). The bottom line: don't install the (Java 7) JDK from Oracle unless you're an expert user."

Summary

It is very difficult to simply disable and re-enable Java 6, let alone delete it entirely, without Unix experience. Expert users may elect to delete key files to prevent Java 6 apps from ever running, but it's not a great idea for the average user without Unix and command line experience. It's better to be aware if you're running a native Java app, built for Java 6, and then keep Java 6 updated (with Software Update in OS X). Otherwise, find an alternative non-Java solution.

Remember, you're not vulnerable if you run a native Java 6 app, say, a text editor like jEdit, that doesn't visit websites like a browser plug-in is designed to do.

If you really, really want to completely eradicate Java 6 from your Mac, which isn't really necessary, you'll need to do a clean install of Lion or Mountain Lion.

___________________

* There are security issues with Java 6 on 10.5 Leopard that will never be fixed.

Uninstall or Disable Java on a Mac的更多相关文章

  1. How to check for and disable Java in OS X

    Java used to be deeply embedded in OS X, but in recent versions of the OS it's an optional install. ...

  2. Java JDK在Mac下的配置方法

    Java JDK在Mac.Windows下的配置方法 Mac 第一步:下载JDK 官网下载地址 第二步:安装JDK 安装步骤很简单,一直点击下一步即可. 第三步:配置环境变量 打开terminal(终 ...

  3. Install and set JAVA home on MAC OS with commandline

    最近需要在MAC上做一些测试,由于测试机没有安装Java,只能自己安装,由于不能通过图形化界面访问测试机,只能通过命令行的形式来安装JAVA. 1. Download the jre/jdk inst ...

  4. 纯Java获得本地MAC地址

    import java.net.*; public class Ipconfig{      public static void main(String[] arguments) throws Ex ...

  5. 解决javac和java命令在Mac OSX终端里的乱码问题

    转自:https://www.surfchen.org/archives/710 java和javac在简体中文的Mac OSX的终端(Terminal.app)环境下,默认是以GBK编码的中文输出各 ...

  6. docker 安装 hbase安装 java连接hbase (mac环境)

    docker 安装 https://hub.docker.com/editions/community/docker-ce-desktop-mac 下载地址 下载完之后,安装app一样安装就好 安装完 ...

  7. java获取操作系统的MAC地址和硬盘序列号

    1.判断操作系统是Windows还是Linux private static Boolean isLinux() { String os = System.getProperty("os.n ...

  8. 最详细的JavaWeb开发基础之java环境搭建(Mac版)

    阅读文本大概需要 5 分钟. 我之前分享过在 Windows 下面配置 Java 环境,这次给大家带来的是 Mac 下面安装配置 Java 环境.首先 Mac 系统已经带有默认的 Java,但是由于使 ...

  9. java获取电脑mac物理地址

    import java.net.InetAddress;import java.net.NetworkInterface;import java.net.SocketException;import ...

随机推荐

  1. php缓存方案

    一.说说Memcached优化方案 Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提供动态.数据 ...

  2. 【精品】Android游戏类源码大集合

    Android自定义效果——随机抽奖 一个模拟抽奖的效果,用户设定若干个选项,添加之后,就可以通过程序,来帮助随机选择其中一项出来.这个类似超市里面那种指针转盘抽奖,run之后是一个动态效果图,初始快 ...

  3. oracle函数之replace

    replace('将要更改的字符串','被替换掉的字符串','替换字符串'): ','****') from tmall_tcmessage; 输出为 '158****3367'

  4. (转)关于font-size:100%

    重设浏览器默认字体大小 h1,h2,h3,h4,h5,h6 {font-size:100%;font-weight:normal;} 假如你设置body{font-size:12px;} 但h1是不会 ...

  5. (转)2.4.1 基础知识--添加服务引用与Web引用的区别

    <Web服务开发学习实录>第2章构建ASP.NET Web服务,本章我们将学习创建Web服务的各种方法,并重点对使用Visual Studio创建ASP.NET Web服务和修改Web服务 ...

  6. 技术路线 vs 技术管理路线

    最近因为要给刚毕业的学生做一次演讲,所以就职业发展这类话题先以写博客的形式做一些思考,希望届时能给同学们带来质量更高的内容.我在<驾驭你的"职场布朗运动">一文中谈了2 ...

  7. oracle时间戳转换

    select (to_date('2013-04-09 14:02:15','yyyy-mm-dd hh24:mi:ss') - to_date('1970-01-01','yyyy-mm-dd')) ...

  8. 奇怪的JS正则表达式问题

    同一个正则表达式,为什么在JS里,用 var reg = new RegExp("..."); 定义,验证就各种失败,用 var reg=/.../; 定义,验证就对了...

  9. SpringSource Tools Suite 字体偏小问题

    参照了Eclipse小技巧收录http://liuzidong.iteye.com/blog/1320094 发现没有找到相应文件,只有搜索了,一个一个地找,总算找到了,修改方法还是一样,只是路径,文 ...

  10. nignx开启expires后相关资源不显示的问题

    expires可以指定浏览器缓存,加快浏览速度 但是开启expires必须先指定root server中原来指定 location / { root D:/WWW; index index.html ...