当前位置:网站首页>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 .
边栏推荐
- Can Flink's current capabilities support the synchronization of a table from source (MySQL) to sink (MySQL) to separate databases and tables
- 【黑马程序员】Redis学习笔记003:Redis事务
- Raspberry pie CM4 -- using metartc3.0 to integrate ffmpeg to realize webrtc push-pull streaming
- Test the mock data method of knowing and knowing
- 机器学习理论及案例分析(part1)--机器学习基础
- Learn when playing No 5 | human high quality examination, right here →
- A simple SQL injection shooting range exercise
- JS cool rolling picture deformation animation JS special effects
- pom容易忽略的问题
- Raspberry pie 3b ffmpeg RTMP streaming
猜你喜欢

Network packet loss, network delay? This artifact helps you solve all problems

RK3399开发板I2C4挂载EEPROM实例

Redis学习

Eval and assert one sentence Trojan horse analysis

People who lose weight should cry: it's no good not eating food, because your brain will be inflamed
Cache design in Web services (error allowed, error not allowed)

CAS操作

Pet adoption system based on ssm+mysql+layui

Test the mock data method of knowing and knowing

Ensembles in RNA counts data in TCGA_ ID to gene_ Method of ID
随机推荐
Didi - dispatching
Interview questions: common faults and occurrence scenarios of redis
Refreshing mobile terminal personal center page
eval与assert一句话木马分析
Network file storage system (II) practical operation of Minio distributed file system
uiautomator2 常用命令
Oracle trigger creation
Science: listening to music can really relieve pain. Chinese scientists reveal the neural mechanism behind it
Raspberrypico analytic PWM
ArcGIS Pro脚本工具(10)——从图层生成.stylx样式符号
Eval and assert one sentence Trojan horse analysis
第3章业务功能开发(实现全选按钮实时的响应)
Introduction to machine learning (I): understanding maximum likelihood estimation in supervised learning
【keras bug】Tensor is unhashable if Tensor equality is enabled. Instead, use tensor.experimental_ ref(
475-82(230、43、78、79、213、198、1143)
enq: HW – contention等待引起的故障分析
Raspberry pie CM4 -- using metartc3.0 to integrate ffmpeg to realize webrtc push-pull streaming
The difference between batchnorm and layernorm
【音视频】图片YUV数据格式
[shader realizes shadow projection effect _shader effect Chapter 8]