When you try to launch a Java jar application from the Terminal/Command Line and you get "A Java Exception has occurred", the most likely reason is that a Runtime exception or an Error has occurred when trying to execute the program.
How to fix Exception Occurred Issue
- Go to the console and see what exception stack trace you see and try to collect more information.
The most common reason is that you are using a different version while running the Java application and you get an UnsupportedClassVersionError.
Exception in thread "main" java.lang.UnsupportedClassVersionError: Unsupported major minor version 63.0 ...
Another most common exception you will see is NoClassDefFoundError
Exception in thread "main" java.lang.NoClassDefFoundError:
- Make sure that the Java version during executing the program is compatible with the application.
- It could be so that you are using 3rd party dependencies that are either not available during running the application or are properly configured.
- If you see a OutOfMemoryError: PermGen Exception you would need to increase the JVM memory allocation using the -Xmx parameter.
- Go back to your IDE and try to run the application in debug mode to identify what has caused the exception.
Facing issues? Have Questions? Post them here! I am happy to answer!
- Deep Dive into Java 8 Predicate Interface
- Read and Parse XML file using Java DOM Parser [Java Tutorial]
- Java 8 Predicate Functional Interface isEqual() Method Example
- Convert Multidimensional Array toString In Java
- How to read int value using Scanner Class Java
- Spring Boot AI + LLM + Java Code Example
- Write to a File using Java Stream API
- Implementing Bubble Sort Algorithm using Java Program
- How to Fix XmlBeanDefinitionStoreException in Java SpringBoot ApplicationConfig.xml
- YAML Parser using Java Jackson Library Example
- [Fix] java: integer number too large compilation error
- Convert JSON String to Java GSON Object Example
- Read a file using Java 8 Stream
- Java Spring Boot 3 Web Hello World with Gradle in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Pretty Print JSON String in Java Console Output
- Java JDBC with Join Queries Example
- How to Check For Updates on Windows 11 (Step-by-Step)
- [Fix] java.net.MalformedURLException: unknown protocol
- How to display date and time in GMT Timezone in Java
- Error: LinkageError occurred while loading main class UnsupportedClassVersionError [Eclipse Java]
- How to convert a String to Java 8 Stream of Char?
- RabbitMQ Queue Listener Java Spring Boot Code Example
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..]
- Handling NullPointerException with Java Predicate
- How to minimize all Windows in Mac - MacOS
- Clear SFTP Prompt Screen on macOS Terminal - MacOS
- Get Button Text onClick Android App - Android
- How to Create a Website (Webpage) using HTML on Windows Notepad - Windows
- Open Docker from Terminal Command on Mac - MacOS
- Mac - Open Finder App using Terminal Current Location - MacOS
- Android M cannot run app using play button : Android Studio - Android
- Java: Convert a Text file into Array of Bytes Example - Java