Error: A JNI error has occurred, please check your installation and try again SOLVED Java Intellij

Error: A JNI error has occurred, please check your installation and try again SOLVED Java Intellij


Error: A JNI error has occurred, please check your installation and try again SOLVED Java Intellij

How to solve Error: A JNI error has occurred, please check your installation and try again and Exception in thread “main”java.lang.UnsupportedClassVersionError:com/example/demo/DemoApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0 in java spring boot and intellij idea is shown


Content

0.54 -> hi everyone in this video I will be showing you  how to solve the error a jni error has occurred  
6.48 -> please check your installation and try again  so this error occurs in Java as well as spring  
11.22 -> boot application in some cases and I'm going  to show how you can solve this in IntelliJ  
15.54 -> so this error also has another part like has  been compiled by more recent version so I'll  
21.6 -> be showing you four ways how you can solve  this particular error so first way is going  
26.28 -> to be downloading the latest version of java  so for doing that you have to just go to like  
31.38 -> browser and type Java download you'll  be having Java downloads over here  
35.58 -> just click it if you have already downloaded the  latest version of java it's well and good and  
40.08 -> I'm also having a solution for that as well so  if you haven't downloaded just go and download  
44.16 -> the latest version of java I think the latest  version is 19 and you can also download 17 so  
48.96 -> just go select the particular version and click on  Windows or your required operating system and just  
53.58 -> click on this installer one you can download  it so after downloading a particular latest  
58.02 -> version you need to go to the location where  you have installed which is C program files  
63.9 -> it's going to be Java this is a default  location and I am having jdk 17 I will  
69.06 -> go with that and need to go to bin just copy this  particular path so this is going to be our second  
75.48 -> method which is move up the path in environment  variables just copy the path till bin folder and  
81.18 -> you need to go to search and you need to just  type environment variables and click on open
89.46 -> and you'll be getting the system properties dialog  box just click on environment variables again and  
94.74 -> need to go to path click on edit so you'll be  getting all the paths over here and I am having  
99.24 -> the I've already added the path over here jdk  17 if you haven't added just click on new and  
103.86 -> paste the path and click on OK so since I've  already added I am not going to add it now so  
109.02 -> after adding the path what you are doing is you  have to move this particular path the top most  
113.58 -> all right so you will just select this particular  path jdk 17 bin and need to just click on move up  
119.4 -> so that particular path should come at the top  and after only all the remaining Java or all the  
124.8 -> remaining paths should come so after removing  it to the up just click on OK everywhere yeah  
130.5 -> so this in some cases May fix your error  and even this also doesn't work we need to  
135.42 -> change the settings inside our IntelliJ  or eclipse or your IDE so two important  
140.16 -> things two places where you would change  one is file you need to go to settings
146.76 -> and in the settings you will be having this build  execution deployment and inside that you will be  
153 -> having the build tools Gradle and here you  can see you need to select the particular 17  
157.92 -> or the latest version all right they will be like  getting a list if you aren't having you can even  
161.94 -> download it from here so just select the latest  version so it's already latest version for me so  
166.44 -> I won't disturb anything over here the second  thing where you want to change is file you'll  
171 -> be having project structure click it and here in  Project structure you'll be having the project  
175.92 -> okay and inside that you will be having the SDK  you need to select the latest version here as well  
181.14 -> so be careful both the SDK and that particular  jdk that you've mentioned over there should be  
186.18 -> the same versions so just click on apply yeah so  latest version 17 I will click OK here as well so  
193.2 -> it'll take some time to load and if I just now  run it I will run and check and after that even  
198.24 -> if it doesn't work I will be showing you the  final method so yeah so if I just now run it
206.82 -> so here you can see this time I'm not getting  any error and my application has now started  
210.96 -> if you are just compelling a Java program that  will also work most probably and if it doesn't  
215.76 -> work now also the final method is going to be  uninstalling all the unnecessary Java versions  
221.16 -> that is the old versions that you're having in  your system so for doing that you will just go to  
226.44 -> search and type control panel just click on open
232.86 -> and you need to go to programs you'll  be having the programs and features
239.52 -> and you will be getting the list of all the  applications and programs that you have installed  
244.14 -> on your system and here you can see we will be  having this Java 8 Java SC development kit 8  
250.92 -> Java kit 19 so we will be uninstalling the older  versions of java that we have like we need to just  
258.06 -> only have the latest version of java so by doing  this in some cases it may work so try this as well  
264.42 -> so just like let me just wait till it loads so it  has loaded now so here you can see I'm having Java  
270.96 -> 8 update this is I think the oldest version and 17  and 19 are the latest version so if you're having  
275.88 -> any older versions you need to just right click it  and just click on uninstall it will automatically  
280.8 -> uninstall from your system so just have the  latest version alone in your system and you  
284.4 -> need to like restart your IntelliJ as well just  close and open it and I think this will work so  
288.96 -> these are some of the four ways how I solved this  issue and I hope you would have found this video  
293.46 -> useful mine's a programming Channel by the way I  have done many videos in C C++ Java python node.js  
299.64 -> react JS mongodb MySQL so do check other videos  of my channel subscribe me thanks for watching

Source: https://www.youtube.com/watch?v=IYYETxC8keI