Home › Java › "A Java Exception Has Occurred": How to Fix the Java Virtual Machine Launcher Error
Beginner 3 min · November 09, 2026

"A Java Exception Has Occurred": How to Fix the Java Virtual Machine Launcher Error

The 'A Java Exception has occurred' popup hides the real error because javaw.exe has no console.

N
Naren Founder & Principal Engineer

20+ years shipping production Java in banking & fintech. Written from production experience, not tutorials.

Follow
✓ Production
production tested
November 09, 2026
last updated
2,128
articles · all by Naren
Before you start⏱ 6 min
  • ✓Running Java programs
 ● Production Incident 🔎 Debug Guide
⚡Quick Answer
  • The popup hides the real error: javaw.exe has no console.
  • Open a terminal and run: java -jar app.jar
  • Most common result: UnsupportedClassVersionError: the jar was built with a newer Java than the one running it.
  • Class file version - 44 = Java version (52 = Java 8, 55 = 11, 61 = 17, 65 = 21).
  • java -version shows the default Java; where java lists every java.exe on PATH (first wins).
  • Fix: run it with the newer Java's full path, put that Java first on PATH, or remove the old one.
✦ Definition~90s read
What is A Java Exception Has Occurred?

'A Java Exception has occurred' is the Java Virtual Machine Launcher popup shown when a program started with javaw.exe (what double-clicking a .jar on Windows uses) fails during startup. javaw has no console, so the actual exception isn't shown. Running the same jar with java -jar in a terminal prints it.

★
It's a car dashboard that only says 'Problem'.
Plain-English First

It's a car dashboard that only says 'Problem'. Plug in the diagnostic cable (run it from a terminal) and it tells you exactly what's wrong.

Double-click a jar, get a box that says 'A Java Exception has occurred', and nothing else. Reinstalling Java often doesn't help, because the problem is usually which Java runs, not whether Java is installed. The first step is always to see the real error.

Why the Popup Says Nothing

Windows opens .jar files with javaw.exe, the console-less launcher. When startup throws, the message would go to a console that doesn't exist, so you get a generic box.

run.batBAT
1
java -jar app.jar
Output
Error: LinkageError occurred while loading main class app.Main
java.lang.UnsupportedClassVersionError: app/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 52.0
🎯 Key Takeaway
javaw has no console.

Built Newer, Run Older

A class compiled for Java 21 has class file version 65. Java 8 only reads up to 52. Subtract 44 to get the Java version.

versions.txtTEXT
1
2
3
4
52 = Java 8
55 = Java 11
61 = Java 17
65 = Java 21
🎯 Key Takeaway
Class version - 44 = Java version.

Which Java Runs?

Windows runs the first java.exe on PATH. Old installers add C:\Oracle\Java\javapath early, so an old Java can win even with a newer one installed.

check.batBAT
1
2
3
java -version
where java
javap -v -cp app.jar app.Main | findstr major
🎯 Key Takeaway
First on PATH wins.

Fix It

Run the jar with the newer Java's full path, put that Java first on PATH (or set JAVA_HOME and its bin first), or uninstall the old Java.

fix.batBAT
1
"C:\Program Files\Java\jdk-21\bin\java.exe" -jar app.jar
🎯 Key Takeaway
Make the right Java run.
● Production incidentPOST-MORTEMseverity: high

The Tool That Worked on Every PC But One

Symptom
Double-clicking app.jar showed 'A Java Exception has occurred'. Java 21 was installed.
Assumption
The Java install was broken, so it was reinstalled. Same popup.
Root cause
C:\Oracle\Java\javapath, left by an old Java 8 installer, came first on PATH. Java 8 can't read class file version 65.
Fix
Removed the old Java 8 and its javapath entry; java -version then reported 21.
Key lesson
  • Run java -jar in a terminal first.
  • Check where java, not just whether Java is installed.
  • Class version - 44 = Java version.
Production debug guideFrom popup to cause4 entries
Symptom · 01
Popup with no details
→
Fix
Run java -jar app.jar in a terminal to see the exception.
Symptom · 02
UnsupportedClassVersionError
→
Fix
java -version and where java; run with the newer Java.
Symptom · 03
NoClassDefFoundError / ClassNotFoundException
→
Fix
A dependency is missing from the jar or classpath; rebuild as a fat jar or add the libraries.
Symptom · 04
Could not create the Java Virtual Machine
→
Fix
Bad JVM options, often -Xmx too large or a typo in JAVA_TOOL_OPTIONS / _JAVA_OPTIONS.
⚙ Quick Reference
4 commands from this guide
FileCommand / CodePurpose
run.batjava -jar app.jarWhy the Popup Says Nothing
versions.txt52 = Java 8Built Newer, Run Older
check.batjava -versionWhich Java Runs?
fix.bat"C:\Program Files\Java\jdk-21\bin\java.exe" -jar app.jarFix It

Key takeaways

1
The popup hides the error.
2
Run java -jar in a terminal.
3
Usually a version gap.
4
where java shows which runs.
5
Class version - 44 = Java version.

Common mistakes to avoid

2 patterns
×

Reinstalling Java

Symptom
Same popup.
Fix
Check which java runs: where java.
×

Debugging from the popup

Symptom
No information.
Fix
Run java -jar in a terminal.
INTERVIEW PREP · PRACTICE MODE

Interview Questions on This Topic

Q01JUNIOR
What does UnsupportedClassVersionError mean?
Q01 of 01JUNIOR

What does UnsupportedClassVersionError mean?

ANSWER
The class was compiled for a newer Java than the runtime executing it.
FAQ · 2 QUESTIONS

Frequently Asked Questions

01
How do I fix 'A Java Exception has occurred'?
02
Why does reinstalling Java not fix it?
N
Naren Founder & Principal Engineer

20+ years shipping production Java in banking & fintech. Written from production experience, not tutorials.

Follow
✓ Verified
production tested
November 09, 2026
last updated
2,128
articles · all by Naren
🔥

That's Exceptions. Mark it forged?

3 min read · try the examples if you haven't

←
Previous
Java UnsupportedClassVersion Fix
5 / 9 · Exceptions
Next
Spring NoSuchBeanDefinition Fix
→