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

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

Questions : IntelliJ Error: A JNI error has occurred, please check your installation and try again

2022-08-16T14:26:23+00:00 2022-08-16T14:26:23+00:00

707

I am trying to run a project in intellij and anycodings_intellij-idea every time I run a particular class, I get anycodings_intellij-idea the below error message:

*Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/streaming/StreamingContext at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.apache.spark.streaming.StreamingContext at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)**

Total Answers 2

33

Answers 1 : of IntelliJ Error: A JNI error has occurred, please check your installation and try again

I was facing the same issue for so long, anycodings_intellij-idea my code was raising the same error while anycodings_intellij-idea executing the following line:

val ssc = new StreamingContext(sc, Seconds(10))

my POM.xml looked like this:

<dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-streaming_2.11</artifactId> <version>2.3.4</version> <scope>provided</scope> </dependency>

You see that additional line anycodings_intellij-idea <scope>? Once I removed that line anycodings_intellij-idea from my POM file, the code was back on anycodings_intellij-idea track, successfully executed.

So please make sure you remove the anycodings_intellij-idea <scope> from the dependency.

<dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-streaming_2.11</artifactId> <version>2.3.4</version> </dependency>

0

2022-08-16T14:26:23+00:00 2022-08-16T14:26:23+00:00Answer Link

mRahman

3

Answers 2 : of IntelliJ Error: A JNI error has occurred, please check your installation and try again

You have to add the spark-streaming anycodings_intellij-idea dependency into SBT using the spark anycodings_intellij-idea version :

libraryDependencies += anycodings_intellij-idea "org.apache.spark" %% "spark-streaming" anycodings_intellij-idea % "your spark version"

0

2022-08-16T14:26:23+00:00 2022-08-16T14:26:23+00:00Answer Link

jidam

IntelliJ IDEA - Error: A JNI error has occurred, please check your installation and try again

Questions : IntelliJ IDEA - Error: A JNI error has occurred, please check your installation and try again

2022-08-16T14:26:23+00:00 2022-08-16T14:26:23+00:00

631

Im getting >>> anycodings_java-11 /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java Error: anycodings_java-11 A JNI error has occurred, please check your anycodings_java-11 installation and try again Exception in anycodings_java-11 thread "main" java.lang.SecurityException: anycodings_java-11 Prohibited package name: java.streams

package java.streams; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; public class WritingFiles { public static void main(String[] args) throws IOException { // Stream Connectivity File file = new File("/Users/qasim_lp/Downloads/LearnJava/src/main/resources/myTextFileCreated.txt"); FileWriter fileWriter = new FileWriter(file); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); // Writing inside the file bufferedWriter.write("First Line"); bufferedWriter.newLine(); bufferedWriter.write("Test"); // Closing the stream bufferedWriter.close(); } }

Any help? :)

Total Answers 1

30

Answers 1 : of IntelliJ IDEA - Error: A JNI error has occurred, please check your installation and try again

Move your class to the package that is anycodings_intellij-idea not reserved for the JDK classes. Use anycodings_intellij-idea Refactor | Move in IntelliJ IDEA. You anycodings_intellij-idea can't use java.streams normally, try anycodings_intellij-idea something like com.company.blabla anycodings_intellij-idea instead.

0

2022-08-16T14:26:23+00:00 2022-08-16T14:26:23+00:00Answer Link

mRahman

How do you fix a JNI error has occurred Please check your installation?

This a JNI error has occurred Minecraft server error occurs when you try to start Minecraft or a Minecraft server on a PC that does not have the latest version installed. To fix this, you just need to update your current Java to the latest version.

How do I fix Java error JNI error has occurred?

Fix JNI Error in Minecraft (2022).
Update And Install Latest Java Version (Windows, Mac, and Linux).
Reset Java Path to Fix Minecraft JNI Error (Windows Only).
Install Java on Linux to Fix Minecraft Errors..
Uninstall Old Versions of Java on Your PC (Optional).

How do I check my Java version Intellij?

In the Project Structure dialog Ctrl+Alt+Shift+S , select SDKs. Select the necessary JDK version if you have several JDKs configured, and open the Documentation Path tab on the right.