Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The message “A Java Exception has occurred” is not the actual diagnosis. On Windows, it usually means that javaw.exe tried to start a Java program and failed. The useful error is the exception text printed in Command Prompt.

Start by launching the JAR manually. That tells you whether the problem is an incorrect Java version, a broken file association, a missing dependency, an invalid path, or an application-specific failure.

1. Run the JAR from Command Prompt

Do not double-click the JAR first. Double-clicking commonly starts Java through javaw.exe, which displays a dialog instead of leaving the complete diagnostic output in a console.

  1. Open the folder containing the JAR.
  2. Click the address bar in File Explorer, type cmd, and press Enter.
  3. Run the JAR with java -jar “program.jar”.

Alternatively, open Command Prompt and change to the folder with cd /d “C:\path\to\the\folder”, then run java -jar “program.jar”.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Copy the complete output, including the first line containing Exception or Error. The dialog itself is only a symptom.

Oracle documents the launcher syntax as java [options] -jar jarfile [args …]. A runnable JAR must contain a manifest entry such as Main-Class: com.example.Main.

If the output says that the JAR has no main manifest attribute, the file may not be a directly executable application. Use the program’s documented startup command instead. If you know the main class and its dependencies, an explicit class path may look like java -cp “program.jar;lib\*” com.example.Main.

Opening a JAR as an archive in File Explorer is not the same as running it. The -jar option executes the manifest-defined entry point.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Check which Java Windows is using

A Java installation can be present while the application uses a different installation. Windows may find Java through several PATH entries or Oracle’s javapath shim.

Run where java and java -version. where java lists every matching executable found through the current search path. The first result is normally the one that runs. java -version displays the Java product version; Oracle notes that this form writes its version information to standard error. java –version is also valid and writes to standard output.

Pay attention to results such as C:\Program Files\Common Files\Oracle\Java\javapath\java.exe and C:\Program Files\Java\jdk-25\bin\java.exe.

The first path can win even when a newer JDK is installed. Oracle documents a case where installing JRE 8 after JDK 25 causes java -version to report Java 8 because the JRE 8 javapath entry comes earlier.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Test the correct Java installation directly

Bypass PATH and the file association by calling the executable you actually want. For an Oracle JDK 25 installation, try “C:\Program Files\Java\jdk-25\bin\java.exe” -version and “C:\Program Files\Java\jdk-25\bin\java.exe” -jar “C:\path\to\program.jar”.

Oracle’s default JDK 25 folders may be C:\Program Files\Java\jdk-25 or C:\Program Files\Java\jdk-25.0.1, depending on the installed release. Oracle also creates a latest junction for the latest installed JDK 25 feature release. Check the actual folders on your computer rather than copying a path that does not exist.

The same Java launchers may also be present here: C:\Program Files\Common Files\Oracle\Java\javapath\java.exe and C:\Program Files\Common Files\Oracle\Java\javapath\javaw.exe.

If the full-path command runs the program successfully, Java itself is probably usable. The problem is more likely PATH ordering or the JAR’s Windows file association. You can continue using a batch file with the explicit path, or correct the PATH and association.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Fix an incompatible Java version

The most important error to recognize is UnsupportedClassVersionError. A typical message says the program “has been compiled by a more recent version of the Java Runtime,” with class file version 60.0, while the runtime recognizes versions only up to 52.0.

This means the program was compiled with a newer Java version than the runtime currently launching it. In this example, class-file version 60.0 requires Java 16, while 52.0 corresponds to Java 8.

Installing Java 8 again will not fix that specific error. Launch the application with a sufficiently new runtime, or install the version required by the application’s documentation.

Error detail Meaning Likely action
Compiled by a more recent version The runtime is too old Use the required newer Java version
Could not find or load main class The class path, working folder, or startup command is wrong Use the documented command and verify paths
No main manifest attribute The JAR does not identify a startup class Use another launcher command or specify the main class
ClassNotFoundException A required class or dependency is unavailable Restore the dependency or use the application’s original package
FileNotFoundException A required file or resource cannot be found Check the working directory, installation, and file names

Do not assume that the newest Java release is always correct. An application may depend on an older runtime, removed options, removed modules, old native libraries, or a particular mod or plugin. The application’s documentation, launcher, server version, or build configuration determines the compatible Java version.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Reinstall or repair Java only when the evidence points to Java

Reinstalling Java is appropriate when the executable is missing, the installation is damaged, or the required version is not installed. It is not a general remedy for every exception printed after the application has already started.

Before replacing a JDK directory, stop all Java processes. Oracle warns that Java processes should not be running while the JDK is updated, overwritten, or replaced.

For an Oracle JDK installation on Windows:

  1. Download the required JDK release from the official source.
  2. Close the application, launchers, servers, and Command Prompt sessions using that installation.
  3. Run the installer as an administrator.
  4. Confirm the installed location.
  5. Repeat where java, java -version, and the full-path JAR test.

Oracle documents these installer commands: jdk-25_windows-x64_bin.exe /s and msiexec.exe /i jdk-25_windows-x64_bin.msi.

If an uninstall fails and later Java installations are blocked, use Microsoft’s Program Install and Uninstall troubleshooter. Oracle lists manual registry editing only as a fallback, so do not start by deleting Java registry keys at random.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For Oracle’s installer error 1722, check whether the installation path contains characters unsupported by the system locale’s code page. Oracle’s mitigation is to use a path supported by that code page and ensure the relevant user and system locales match.

6. Repair PATH or use a controlled launcher

If the correct Java works with a full path but not with java -jar, fix the environment rather than the JAR.

  1. Press Windows, search for environment variables, and open Edit the system environment variables.
  2. Click Environment Variables.
  3. Under System variables or User variables, select Path and click Edit.
  4. Remove obsolete Java entries or move the required Java bin directory ahead of an unwanted older installation.
  5. Open a new Command Prompt and run where java again.

Do not edit PATH in an existing console and expect that console to automatically refresh. Open a new one after making changes.

A batch file is often safer for a server or dedicated application because it makes the chosen runtime explicit. For example: @echo off, then “C:\Program Files\Java\jdk-25\bin\java.exe” -jar “C:\Servers\server.jar” nogui, followed by pause.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the version and paths required by that application. The pause line keeps the window open so you can read a failure after the process exits.

7. Minecraft Java Edition: use the server’s own requirements

Minecraft’s official server page does not prescribe one Java version for every server release. It says the server needs a compatible Java version and tells Windows users to make sure java works from the command line.

From the server folder, test java -version and java -jar server.jar. Replace server.jar with the actual downloaded filename. Omitting nogui starts the graphical server interface. Adding it starts the server without the GUI: java -jar server.jar nogui.

If the server reports an incompatible class-file version, match Java to that Minecraft server release rather than blindly installing the newest Java. If the server starts and then reports a missing resource, invalid path, mod failure, or plugin exception, changing PATH will not repair that application-level problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

8. Check application-specific failures

Java can launch correctly and still display an exception because the application itself is broken or misconfigured. Common clues include:

  • FileNotFoundException for a missing library, configuration file, or resource.
  • Invalid or malformed characters in a file path or URL.
  • ClassNotFoundException after a dependency was deleted or placed in the wrong folder.
  • Native library errors caused by an incompatible mod, plugin, architecture, or operating-system component.
  • A damaged or incomplete download.

Look at the bottom of the stack trace for the exception’s cause, then work upward to identify the application class that triggered it. Re-download the application from its official source if files are missing, restore its original folder structure, and follow its documented launch command.

Do not delete META-INF from the JAR as a general repair. That changes the application archive, can invalidate signatures, and may break its packaging. It does not repair a Java runtime. A stack trace identifying the failing class, dependency, path, manifest, or required runtime is the safer guide.

Quick diagnostic checklist

  1. Run java -jar “file.jar” in Command Prompt.
  2. Save the complete exception and stack trace.
  3. Run where java and java -version.
  4. Look for UnsupportedClassVersionError.
  5. Compare the required Java version with the one actually running the JAR.
  6. Test the JAR with the full path to the intended java.exe.
  7. If that works, repair PATH or create a batch file with the explicit path.
  8. If Java starts but the application throws a file, dependency, path, mod, or plugin error, repair the application instead.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

FAQ

Why does Java say “A Java Exception has occurred” when I double-click a JAR?

Double-clicking commonly launches the file through javaw.exe, which shows a generic failure dialog instead of keeping the full console output visible. Run java -jar “file.jar” from Command Prompt to see the actual exception.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do I need a JDK to run a Java JAR?

Not necessarily. The Java launcher is enough to run a JAR. A JDK is needed for compilation and development tools such as javac. Use the runtime version required by the application.

Will installing the latest Java fix the exception?

No. The required version depends on the application. A newer runtime can still be incompatible with old options, modules, native libraries, mods, or plugins. Read the complete exception and the application’s requirements first.

What does class file version 60.0 mean?

It indicates code compiled for Java 16. If the same message says the runtime recognizes only up to class file version 52.0, Java 8 is running the program and is too old for it.

Why does java -version show an old version after I installed a new one?

Windows may be finding an older PATH entry or an Oracle javapath shim first. Run where java, inspect the first result, and test the intended installation by calling its full bin\java.exe path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does a Minecraft server JAR fail even though Java is installed?

The server still needs a compatible Java version, and the command may be using a different installation than the one you installed. Run java -version and java -jar server.jar from the server folder, then follow the server release’s requirements.

Can deleting META-INF fix a Java exception?

No. Deleting META-INF is not a general Java repair and can invalidate signatures or damage the JAR’s packaging. Use the stack trace to identify the actual missing dependency, path, manifest, or version problem.

The Bottom Line

Bottom line: treat “A Java Exception has occurred” as a prompt to collect better diagnostics, not as the diagnosis itself. Run the JAR in Command Prompt, verify where java and java -version, test the intended executable by its full path, and match Java to the application’s documented requirements. Reinstall Java only when the evidence points to a damaged or missing installation; a path, dependency, manifest, mod, or application error needs a different fix.

References: Oracle Java launcher documentation, Oracle JDK 25 Windows installation documentation, and the official Minecraft server download page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.