MacOS
View all Worklets
MacOSmacOS

macOS - Software Lifecycle - Uninstall Java

Removes all Java JRE and JDK installations from macOS endpoints automatically

Worklet Details

What the Java uninstaller does

This Automox Worklet™ removes all Java installations from macOS endpoints by targeting default installation directories for both JRE and JDK. The Worklet scans system locations and user-specific paths to identify and delete Java components.

The Worklet checks multiple locations where Java typically resides: the JavaVirtualMachines directory, Oracle Java support folders, Java applet plugins, and Java control panel preferences. This comprehensive approach achieves complete removal across all user profiles on the endpoint.

Why remove Java from macOS endpoints

Java installations can consume significant disk space and may introduce security vulnerabilities if not kept up to date. Older Java versions often contain known security flaws that attackers can exploit. Removing unused Java instances reduces your endpoint security surface and frees up storage resources.

Organizations that have standardized on managed applications typically do not need standalone Java installations. Removing Java from endpoints simplifies your software inventory and reduces complexity in version management across your fleet.

This Worklet automates the cleanup process across your endpoint fleet, eliminating the need for manual removal on individual machines. Automation delivers consistency and reduces the time your IT operations team spends on routine maintenance tasks.

How Java uninstallation works

  1. Evaluation phase: The Worklet searches system directories and per-user Java paths to detect existing JRE and JDK installations. It checks for the presence of Java files in /Library/Java/JavaVirtualMachines, /Library/Application Support/Oracle/Java, /Library/Internet Plug-Ins/JavaAppletPlugin.plugin, /Library/PreferencePanes/JavaControlPanel.prefPane, and corresponding user home directory paths.

  2. Remediation phase: When Java installations are detected, the Worklet removes all identified directories using recursive deletion. This includes the complete JDK or JRE folder and all associated Java preference panes and browser plugins across all user accounts on the endpoint.

Java uninstallation requirements

  • macOS endpoints with appropriate permissions to delete system and user directories

  • No running Java applications or processes on the endpoint at the time of remediation

  • Administrator or elevated privileges on the target macOS endpoint

  • Verify no third-party applications depend on Java before running this Worklet on production endpoints

Expected state after Java uninstallation

After the Worklet completes successfully, all Java JRE and JDK installations will be removed from the endpoint. This includes system-wide Java binaries and user-specific Java configurations. Disk space previously consumed by Java files will be freed for other uses.

To verify successful removal, you can check the common Java installation directories using Terminal and confirm they no longer exist. If your applications no longer require Java, you should not encounter any errors related to missing Java runtime environments.

How to validate uninstall java changes

  1. Run this Worklet on a pilot macOS endpoint and review evaluation output for uninstall java.

  2. Confirm Automox activity logs show successful completion and exit code 0.

  3. Verify endpoint state using checks aligned to evaluation script logic, such as function, exit, checkContents.

  4. Validate remediation effects from script operations such as function, rm, removeContents, then rerun evaluation for compliance.

For technical validation, compare endpoint state to the Worklet evaluation logic and remediation flow for uninstall java. This supports repeatable software lifecycle workflows, faster change control review, and auditable compliance evidence.

Useful script references for this Worklet include evaluation operations such as function, exit, checkContents and remediation operations such as function, rm, removeContents. Use these indicators to verify that endpoint changes match intended policy outcomes.

View in app
evalutation image
remediation image

Consider Worklets your easy button

What's a Worklet?

A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

do more with worklets