IDEA always shows .class instead of .java source code when viewing source code (solution)

problem

Using IDEA to look at the source code, there is a .class file instead of a .java file, which is still the case when uninstalling and reinstalling.

The situation is now

Just use IDEA, when we want to view the source code like eclipse, we will press Ctrl+ 鼠标左键
but the .class file appears, as shown in the figure Insert picture description here
below, there is a line of English below

  • Decompiled .class file, bytecode version:55.0(Java 11)

  • Translation : Decompiled .class file bytecode version: 55.0 (Java 11)

Solution

Use your own JDK

Choose your own JDK when creating the project,
Insert picture description hereclick New as shown below , choose the JDK path you installed, and then just as before. In this way, the project you created is a .java file when looking at the source code.
Insert picture description here
Then, set it up, as shown below
Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42524288/article/details/101375039
Recommended