Tag Archives: JAVA error

Java command line uses a JNI error has occurred, please check your installation and try again

Error: a JNI error has occurred, please check your installation and try again
exception in thread “main” java.lang.UnsupportedClassVersionError : Demo has been compiled by a more recent version of the Java Runtime (class file version 55.0), This version of the Java runtime only recognizes class file versions up to 52.0

jre8u164 was installed once before in the system, and jdk11.0.2 was installed without uninstalling. It is estimated that there is a conflict. Just delete jre8u164.

Extended content

For the concepts and differences of JDK, JRE, Java se, Java EE and java me, please refer to https://www.cnblogs.com/In-order-to-tomorrow/p/3652315.html

[How to Fix]No executorfactory found to execute the application

Error information

Cause of error

Starting from Flink 1.11, the dependency of flink-streaming-java on flink-clients has been removed and the clients dependency needs to be added manually.

How to Fix

Modify the POM file and add the Flink clients dependency


Java error: unable to find or load main class (package name in source file)

1. Problem orientation

This type of error occurs when compiling (javac) and executing (Java) Java programs: the main class cannot be found or loaded:

First of all, the problem caused by improper configuration of environment variables is excluded. As long as the command line interface can recognize javac / Java commands, there is no problem with the configuration of environment variables. This problem often occurs because there is a package name in the Java source file, such as the file C:: code\ Hello.java :

package com.example;

public class Hello{
    public static void main(String[]args){

It seems that there is no problem

C:\code>javac Hello.java
C:\code>java Hello
Error: Main class not found or could not be loaded Hello

2. Solutions

Delete the package name from the source file (not recommended); create a file path structure with the same package name under code (C:: – Code ⁃ com ⁃ example)\ Hello.java )

Compilation:C:\code>javac com/example/Hello.java
Run:C:\code>java com.example.Hello

A JNI error has occurred, please check your installation and try again

1. The question is:
A JNI error has occurred once again, please check your installation and try again

2. Analysis:
The JDK was installed repeatedly and there were different versions on the computer
3. Solution:
The command line through “Java-version” and “Javac-version” query SDK version
Delete the unwanted version (uninstall in the control panel)
(3) Adjust the environment variable to leave the JDK related information
Recompile to see whether there is still an error
4. The validation:
Javac is the same version as the Java directive