Java used to be deeply embedded in OS X, but in recent versions of the OS it's an optional install. Here is how to check to see if it is installed, and how to disable or remove it.

There's some concern over the use of Java in OS X following a recent finding that Flashback malware variantsare now taking advantage of currently unpatched vulnerabilities in the Java runtime.

Even though this malware development should not affect the majority of Macusers running OS X 10.7 or later since Apple no longer includes Java with the OS, some people may nonetheless be wondering what the Java runtime is, and how they can go about checking for and removing it from their systems to ensure they are safe.

What is Java?
The essence of Java is its runtime, which is a software environment that acts like a small operating system for running the compiled code of a specific programming language, and as such is sometimes referred to as a Virtual Machine. Many programming languages require the use of a runtime, without which they would not work. For instance, the runtime for the JavaScript language (which despite its name has nothing to do with Java) is built into Web browsers so scripts downloaded from Web sites can execute properly, and if you disable JavaScript in your browser's preferences then you disable the runtime and these scripts will not run.

Some other programming languages that use runtimes are Unix shell scripts, whose runtime is the shell itself (bash, sh, csh, etc.); Objective-C, which is the core programming language of OS X and whose runtime is a core library in OS X; and Java, whose runtime can be installed in an operating system and then activated when Java code needs to be executed.

Java's runtime has been a popular programming environment because its programming language is object-oriented, meaning it is well-suited for creating applications that have objectlike components to them, such as the buttons, scroll bars, and other features of a user interface. In addition, Java is built to be cross-platform, so programmers should only need to build one version of their Java code and then be able to deploy it to any operating system that has the Java runtime installed. In this sense the cross-platform effort is isolated to the runtime, instead of being a burden to the developer.

The Java Preferences application will list the runtimes available, and you can uncheck them to disable Java on your system.

(Credit: Screenshot by Topher Kessler/CNET)

These features have seen Java used in numerous programs, including Adobe's Creative Suite and other professional and scientific applications like Matlab. Even if Java is not used in the entire program, by using it in common components a developer can make porting the application to different platforms much easier.

Problems with runtimes
While runtimes such as Java offer support of new programming languages and thereby allow increased functionality to your system, they do open up more possibilities for security breaches. Code running in them will need to be isolated with sandboxing routines and other security measures to prevent unauthorized access to private or critical resources, but these measures will have to be implemented within each runtime and then tested to ensure that they cannot be breached. If a security hole is discovered, then the runtime will need to be updated to correct the problem.

With regard to Java, the runtime for Windows has been given more attention than that for OS X, so when security holes are discovered, it takes longer for the OS X version to be patched and therefore provides a better window of opportunity for malware developers to tackle it. With its latest variant, the Flashback malware has taken advantage of this window and is now targeting the unpatched Java runtime for the Mac OS.

In this case the vulnerability allows the malware to break the Java sandbox rules and write code to the disk, followed by executing it.

Checking for Java
Luckily unless a specific program needs Java, then the Java runtime is not required for OS X. None of the operating system's features need Java to run, and it's components are only present in the OS to support the runtime if you choose to install it for your needs.

Starting with OS X 10.7 Apple stopped including a Java runtime in OS X, but still provides a quick link to install it if you run a program that requires Java. When such a program is launched, you will first be prompted to install the Java runtime but if you choose not to, then the program will quit. As a result, if you have not purposefully taken steps to install Java on a new system, then it will not have a Java runtime and therefore will not be vulnerable to these latest malware attacks; however, if you are unsure whether you have Java installed, there are a couple of ways to check.

When you launch a java application or one that requires it, if you see this notice then you do not have Java installed on your system.

(Credit: Screenshot by Topher Kessler/CNET)

    • Open a Java application
      A simple way to see if you have Java installed is to open an application that requires it, and one of these that is included with OS X is the Java Preferences utility. Go to the /Applications/Utilities/ folder in OS X and launch the Java Preferences program, and if it opens and shows various configuration options, then you have Java installed; however, it if shows a message stating you need Java and provides you with an option to install it, then you do not have Java installed.
    • Use the Terminal
      The OS X Terminal (in the /Applications/Utilities/ folder) provided access to a number of commands that can be used for looking up system information, and by running the following one in the Terminal you should be able to see in the output what Java runtimes (if any) are installed on your computer:

      sudo /usr/libexec/java_home

    • Disabling Java
      If you do have Java installed on your system and would like to disable it, you can easily do so in the Java Preferences utility. When you open the utility you will be presented with a list of the Java runtimes installed on your system, and a check box next to each. By unchecking the runtimes you will prevent them from being used, and unchecking all will disable Java entirely.

      Running this Terminal command will output "No Java runtime present" if you do not have Java installed. By default new Macs will not have Java installed (click for larger view).

      (Credit: Screenshot by Topher Kessler/CNET)

      Once disabled, if you have a program on your computer that requires Java, then the program will simply not run until you enable it again. Therefore, while disabling Java does require an extra step when you want to run Java applications, it does put the control in your hands over what Java programs are allowed to run.

      Uninstalling Java
      Unfortunately there is no direct or easy way to uninstall Java, so once installed the only way to remove it and all of its components completely is to reinstall OS X; however, you can remove the Java virtual machine (the runtime) from your system and thereby perform a similar routine as an uninstall. To do this, go to the /System/Library/Frameworks/ directory and remove the file "JavaVM.framework," which contains the Java runtimes. Additionally, empty the contents of the following directories on the system which link to the runtimes in the framework:

      /System/Library/Java/JavaVirtualMachines
      /Library/Java/JavaVirtualMachines

How to check for and disable Java in OS X的更多相关文章

  1. Uninstall or Disable Java on a Mac

    You can run Java apps in two ways. The first is to run Java applets inside your Web browser with a p ...

  2. How to uninstall (remove) JAVA from OS X Lion

    Open terminal (Applications -> Utilities -> Terminal) To remove JVM enter folowing: sudo rm -r ...

  3. Java性能提示(全)

    http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...

  4. java泛型学习(一)

    泛型也叫做参数化类型,顾名思义的去理解,就是把类型作为一个参数.类比方法的传参,我们举个例子. class A{ public void getX(int x){ System.out.println ...

  5. 深入理解java反射原理

    反射是java的一个特性,这一特性也使得它给了广大的第三方框架和开发过者很大的想像空间. 通过反射,java可以动态的加载未知的外部配置对象,临时生成字节码进行加载使用,从而使代码更灵活!可以极大地提 ...

  6. Java基础——反射

    今天学到Java基础中的反反射.依照我学习后的个人理解呢,反射就是一套获取类.属性.方法等的工具吧.(其实,感觉学完反射后,有点像喝凉水,解渴但确实我也没体会出它有什么味道,我可能没有学到精髓吧.自己 ...

  7. Java高新技术第二篇:反射技术

    今天我们来看一下Java中的反射技术: 首先来了解一下Java中的反射的一些概念: Java中的反射是1.2引入的 反射的基石:class类 Class类的各个实例对象分别对应各个类在内存中的字节码, ...

  8. ubuntu vps 安装java

    Introduction Java is a programming technology originally developed by Sun Microsystems and later acq ...

  9. mac java 环境设置

    MAC下JDK1.6下载路径 http://support.apple.com/kb/DL1572 Mac OS的java版本问题和Eclipse中无法找到jdk源代码的问题解决办法 下载包含源代码j ...

随机推荐

  1. Mac OS X 下修改网卡地址和抵御 ARP 攻击

    用 Mac 系统有一段时间了,这里记录一下自己遇到的需要终端命令解决的问题. 网络环境绑定了原先机器的 MAC 地址,由于特殊原因,先把新机器的网卡地址改成原先那台. 在终端输入sudo ifconf ...

  2. hibernate-4.3.5安装配置

    起初照着官方文档配,一直出错,貌似官方的文档时错的,查了非常多资料,综合整理了一个可行的方案,例如以下: 0.1包结构 test.demo test.domain  //实体类 test.util// ...

  3. 辛星解读mysql的用户管理

    可能做开发的多半不太关注这方面,可是要说到做运维.那就不能不关注了.由于我们都知道,root的权限太大了.不是随便能用的.我们平时最好用一些比較低的权限的用户.这样会让我们的安全性大大提高,也能防止我 ...

  4. ibatis之##与$$的 使用

    /** 主要讲一下ibatis中$$的使用: 是为了传递参数; 参数一定在Action层用''包裹起来: */ List <SysRole> userList= systemService ...

  5. HTML与CSS入门——第十一章  在网页中使用图像

    知识点: 1.在网页上放置图像的方法 2.用文本描述图像的方法 3.指定图像高度和宽度的方法 4.对齐图像的方法 5.将图像转换为俩接的方法 6.使用背景图像的方法 7.使用图像映射的方法 11.1 ...

  6. Web App 前端构建(纯净版)

    asp.net 母版页: <!DOCTYPE html> <html> <head> <meta charset="utf-8" name ...

  7. Windows命令行(DOS命令)教程 -1 (转载) http://www.pconline.com.cn/pcedu/rookie/basic/10111/15325.html

    一.命令行简介 命令行就是在Windows操作系统中打开DOS窗口,以字符串的形式执行Windows管理程序. 在这里,先解释什么是DOS? DOS--Disk Operation System 磁盘 ...

  8. iOS 关于时间戳的一些细节

    最近遇到一个bug,在iPhone上获取当前的时间戳,没有问题,而用iPad来测试的时候,出现了时间戳不对.当时的代码 (需要精确到毫秒,所以*1000) NSTimeInterval t = [[N ...

  9. gitosis随记

    0.创建git用户 useradd -m git passwd git 1.安装脚本工具(gitosis依赖python) apt-get install python-setuptools 2.gi ...

  10. HDU 3966 dfs序+LCA+树状数组

    题目意思很明白: 给你一棵有n个节点的树,对树有下列操作: I c1 c2 k 意思是把从c1节点到c2节点路径上的点权值加上k D c1 c2 k 意思是把从c1节点到c2节点路径上的点权值减去k ...