当前位置:网站首页>Idea2021 failed to start. Could not find main class com/intellij/idea/main
Idea2021 failed to start. Could not find main class com/intellij/idea/main
2022-07-25 08:14:00 【lzhfdxhxm】
Catalog
environmental information :
idea2021.1.1( notes : If it's another version idea, This problem may also occur )
jdk1.8、jdk11

Problem description :
cause :
because idea It takes a long time to start the project ,5 About minutes , So Baidu idea Occupy cpu And high memory , I found that there was an article that said to change idea Of Runtime Version,

operation :
Choose Runtime, From the default sdk11 Change to sdk8,idea The automatic restart failed , Tips :

---------------------------
Error launching IDEA
---------------------------
Could not find main class com/intellij/idea/Main
Solution :
The search results :
Search for this error , The solutions given in domestic articles are mostly configuration jdk The path of , Such as IDEA Initiate error reporting could not find main class com/intellij/idea/main terms of settlement _ Life is like a play All by acting -CSDN Blog
Configure... In environment variables IDEA_JDK_64 wait .
Solutions :
The idea is actually right , Just can't find the start idea When setting jdk Where the path .
idea Provides a way to start from the command line , stay idea Under the installation path of bin Catalog ( and idea64.exe Same path ) There is one idea.bat Batch file , use cmd or PowerShell Execute this bat after , You can see the details of startup , With PowerShell For example :
PS C:\Users\xxx> cd D:\develop\IDEA\bin
PS D:\develop\IDEA\bin> .\idea.bat
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/intellij/idea/Main 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
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
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)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
PS D:\develop\IDEA\bin>
Reporting a mistake means com.intellij.idea.Main This class file The version number is 55.0( Corresponding jdk11), For operation jre yes 52.0( Corresponding jdk8).
For correspondence, please refer to another article of mine JDK version and class file version(Class Build number ) Corresponding relation _lzhfdxhxm The blog of -CSDN Blog
Look at the idea.bat The batch , Sort out the process , You can find the used jre Yes, there is Priority judgment Of . There are comments in the batch :
:: ---------------------------------------------------------------------
:: Locate a JRE installation directory which will be used to run the IDE.
:: Try (in order): IDEA_JDK, idea%BITS%.exe.jdk, ..\jbr[-x86], JDK_HOME, JAVA_HOME.
:: ---------------------------------------------------------------------
IDEA_JDK This environment variable is not configured in my environment variable ;

idea%BITS%.exe.jdk This is not an environment variable , Is the file with the specified path . This file was just installed sdk8 It's automatically generated when / Modified , Here's the picture :

idea64.exe.jdk The content of the document :
C:\Users\lzhf\AppData\Roaming\JetBrains\IntelliJIdea2021.1\jdks\jbsdk8u112b287.2_windows_x64
This path is just installed jre8

resolvent :
Then the solution is simple , Delete idea64.exe.jdk This file Just fine , This will determine the subsequent settings ( This is equivalent to Choose Runtime There is no default sdk11 Change to sdk8).
If you haven't changed other settings , Then the last used jre yes idea Under the installation path jre:

D:\develop\IDEA\jbr\bin\java.exe
That's it ,idea It started successfully !
If there are other personalized configurations , Then according to the idea.bat The logic in is sorted out layer by layer , You can always find your own configuration , And fix it . In the process , You can print logs , To aid judgment .
For example, when printing jre The final value :

Conclusion :
What this blog post solves is idea because jdk The problem of configuration startup failure .
idea2021 Should not directly support jdk8, Because the startup class com/intellij/idea/Main Yes, it is jdk11 Compilation of , Unless you change the startup class to use jdk8 Just compile .
边栏推荐
- JS cool rolling picture deformation animation JS special effects
- Chapter 3 business function development (realize the real-time response of the select all button)
- Implement hot post | community project with timed tasks and cache
- Technical Analysis | Doris connector combined with Flink CDC to achieve accurate access to MySQL database and table exactly once
- Uiautomator2 common commands
- Programmers can't play at the age of 35. Is it a fact or a misunderstanding?
- Problems easily ignored by POM
- 第3章业务功能开发(修改线索,数据回显并修改数据)
- 刷题《剑指Offer》day01
- Install MySQL 8.0 using docker
猜你喜欢

JS typewriter animation JS special effect plug-in autotyperjs

Recommend 7 open source projects of yyds this week

Svg creative underline style JS special effect

A powerful port scanning tool (nmap)

Chapter 3 business function development (modifying clues, data echo and modifying data)

Check the computer restart times and reasons

TCGA simple download tool V16 installation error

刷题《剑指Offer》day01

Node+js build time server

Raspberry pie 4B parsing PWM
随机推荐
uiautomator2 常用命令
【音视频】图片YUV数据格式
Literature learning (part101) -- converge clustering
Technical Analysis | Doris connector combined with Flink CDC to achieve accurate access to MySQL database and table exactly once
7.24模拟赛总结
Science: listening to music can really relieve pain. Chinese scientists reveal the neural mechanism behind it
Learn when playing No 6 | the magic of document library lies in
Cerebral cortex: the relationship between lifestyle and brain function in the elderly and its relationship with cognitive decline
Google AI can't understand the comments of netizens, and the wrong meaning will be as high as 30%. Netizens: you don't understand my stem
Dijkstra序列(暑假每日一题 5)
Supplementary notes on Relevant Issues of complete model group
Check the computer restart times and reasons
Implement hot post | community project with timed tasks and cache
The difference between batchnorm and layernorm
牛客动态规划训练
[audio and video] picture YUV data format
[ffmpeg] MP4 to YUV
Ensembles in RNA counts data in TCGA_ ID to gene_ Method of ID
How to obtain the intersection / subtraction / Union of two sets by MySQL
Problems easily ignored by POM