Linkage error occured while loading main class java in Visual Studio code | Eclipse | Intellij

Linkage error occured while loading main class java in Visual Studio code | Eclipse | Intellij


Linkage error occured while loading main class java in Visual Studio code | Eclipse | Intellij

Linkage error occured while loading main class java in Visual Studio code ,Eclipse, Intellij solved
java.lang.unsupported class version error
‘chcp.com’ is not recognized as an internal or external command
#LinkageError #VisualStudioCode #Eclipse #Intellij #Java #JavaError


Content

3.04 -> so this video i'm going to show you how to solve  linkage error occured while loading main class in  
7.84 -> java so i think so this works fine in  both intellij and visual studio code  
12.64 -> i'm going to show you demo in visual  studio i think it applies for the remaining  
15.76 -> eclipse or intellij so let's get started so  first let me show you how this error occurs  
20.16 -> so i'm having currently a simple java  program over here so if i just run it
26.8 -> and it just runs it takes some time and here  you can see clearly there java dot linkage error  
34.64 -> occurred while loading main class and comes with  some additional uh errors that i don't know why  
41.28 -> but and also says unsupported version something  blah blah blah something so first what you need  
46 -> to do is you need to just go to chrome okay and  just go and type download java jdk okay just type  
54.32 -> java jdk download and you're going to download  version, any other jdk versions other than 15  
60.24 -> okay because i think so this error is caused  by downloading the latest version which is 15  
64.88 -> i would recommend to download any version between  above 11 and below 14 and below i think 14 works  
71.04 -> perfect so just go and download java jdk version  14 just go here and depending upon your os you're  
77.68 -> going to download for windows just go and click  this one okay so after downloading what you need  
82.48 -> to do is you need to go to the file where this  jdk has been installed okay so by default it gets  
87.92 -> installed in c program files and java look i have  15 i've downloaded 15 and 14 as well so we're just  
94.88 -> going to go to the latest one 14 latest download  14 so we're going to 14 or anything between 11  
100.88 -> and 14 we're just going to go that i'm going to  copy the path so okay so just C program files  
105.68 -> java jdk and 14 ctrl c okay and you should not  copy bin basically you should not copy okay you  
111.6 -> should be careful there because it doesn't  work in that way and after copying that what  
116 -> you need to do is you just go to the environment  variable same thing when you are just giving and  
120.64 -> java jdk path okay that's what we are going to do  just copy that and go into environment variables  
126.16 -> and here we have specified the java home path  as java jdk 15 okay we're just going to go to  
131.84 -> click and edit so if you haven't specified  any path you're just going to add a variable  
136.88 -> java home and just delete it and add java jdk 14  path okay so it should be needs to be java home  
144.8 -> variable name and variable value will be the path  just click ok and another thing what we'll do  
149.52 -> is for the next thing what we're going to do is  we'll change also the path for system variables  
154.48 -> so for that what you need to do is just go to the  same thing and in for this now we are going to go  
159.28 -> to the bin folder so just go to bin and copy  entire thing ctrl c and next what just select  
165.28 -> the path and go and click edit so you're going  to select change the first one which is 15 bin  
170.08 -> and we're going to just ctrl v so it's going to be  jdk 14 so we're just going to press ok so if it's  
176.56 -> 14 or anything you're going to replace with the  corresponding one so just replace it and press ok  
182.16 -> so okay over here so now we  are going to check whether the  
185.28 -> version has been updated so just go to command  prompt and type java underscore version
193.52 -> so you can clearly see the version has been  updated we have removed 15 and we have added 14  
197.36 -> over here so this should work i think so if  you use intellij or using eclipse just try  
203.04 -> this one and finish it so i hope this works and  even in visual studio code you need to update  
209.2 -> thing you need to check for the update whether  it's updated in inside which way vs code also  
213.44 -> so for that what we are going to do is control  shift p okay control shift p you already press  
221.36 -> bar will appear and it was just going to type  configure java runtime okay configure java runtime  
228.88 -> you need to type it and select it so it shows  still it shows c program files java 15. so once  
235.84 -> we have changed to the environment variable path  just you're going to close the visual studio code
244.64 -> and you're just going to open a new one
258.48 -> okay so
262.4 -> now what we're going to do just  going to enter control shift  
265.6 -> p just going to same one configure java
268.96 -> runtime
287.68 -> so and you can clearly see here java jdk has  changed to 14 and you can see that that has  
293.68 -> changed so that's a good sign actually it didn't  uh what to say the reload didn't work actually  
299.36 -> in vscode so we restarted vs code that's what  has happened so now if you go and run the code  
305.68 -> okay so this is actually a program  that takes inputs and array and  
311.2 -> array and it returns the average so here you can  see that this some kind of things i don't know  
315.68 -> why it's happening but you can see we didn't get  the linkage error and enter so this is the print  
321.04 -> so i've printed enter over here so this means that  we can get the output so this is i think so it's  
326.08 -> just a kind of like warning something like that  so it is it's just not going to affect our output  
331.28 -> in any other way are not going to cause any error  yeah so it's just a warning so you let me show how  
336.08 -> it works so in this first need to type the length  so i'm going to type five and just five elements
345.68 -> you can see we have got the average of the  five elements as so now this code is perfectly  
350.56 -> working so and so now that we have solved the  linkage error and failed to load main class so  
356.64 -> that's it thanks for watching and I have  done many other tutorials in python and  
361.12 -> android studio and unity so kindly check out the  playlist of my channel and thanks for watching

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