JavaRush/Java Blog/Random EN/IntelliJ IDEA FAQ
Diana
Level 41

IntelliJ IDEA FAQ

Published in the Random EN group
members
This FAQ was created from questions about IntelliJ IDEA in the VK topic in our group .
IntelliJ IDEA FAQ - 1

How can I make it so that the open file is launched in idea, and not the old Solution?

You can run the code if there is a main method. In this case, there are two ways:
  1. Click Ctrl+Shift+F10.
  2. Right-click on the workspace in the desired class and select Run or Debug
IntelliJ IDEA FAQ - 2

How can I make the position number in the line of code where the cursor is located appear on the screen?

Open the View > Status Bar panel and check the box. IntelliJ IDEA FAQ - 3 If the checkbox is checked, then make the window smaller; perhaps the taskbar overlaps the IDEA window.

Gives an error message:

java: try-with-resources is not supported in -source 1.6
(use -source 7 or higher to enable try-with-resources)
You need to set the Java level higher than version 6. Open Project Structure ctrl+alt+shift+s > Project > Project language level .
IntelliJ IDEA FAQ - 4

There are tasks in lectures, but the plugin does not see them

It seems that the plugin in IntelliJ IDEA sees the tasks of another account on the site. You need to compare the secret keys on the site and the plugin. On the website, the secret key can be found in settings . In the plugin, the secret key is located in the JavaRushPlugin.properties file

How to run a program step by step in intellij? So that, for example, when executing a loop from 0 to 4, the assigned values ​​and calculation results at each step are displayed in the console

Read the article "How to use Debug in Intellij IDEA".

Unable to find package java.lang in classpath or bootclasspath

Open the panel File > Project Structure > Platform Settings > SDKs In the Classpath tab , connect all jar files from the “path to installed Java” /jre/lib .

Why did IntelliJ IDEA cross out methods that work great?

These are outdated methods that are not recommended to be used. They may be removed in future versions of the language. These methods are marked with the Deprecated annotation , and IDEA warns about this.

Where in IntelliJ IDEA to enter data that will be read in the program

Action mechanics:
  1. We are writing a program.
  2. Launch Run
  3. A console appears below.
  4. We write data to the console
  5. Press Enter
IntelliJ IDEA FAQ - 5

How to return the window with the result of program compilation, which is located below

We use hot keys: Alt+0- the Message Alt+4 panel will open - the Run panel will open. The remaining panels can be found View > Tool Windows .

Displays ...the SDK is not specified... Or the code is colored red

You need to specify the path to the SDK in your project.
  1. Opens the File > Project Structure panel (ctrl+alt+shift+s).
  2. Select the SDKs tab .
  3. Specify the path to the installed JDK package .
IntelliJ IDEA FAQ - 6
If the code is still tinted red, but the program works, then run File > Invalidate Caches

Why does IDEA highlight some code elements with a brown background for me?

These are the so-called Inspections. You can think of it as a Code Review . If you hover the bear cursor over such an element, IDEA will give a hint and automatically replace the code with a more correct one in IDEA's opinion. In the situation with " for ", there will be a replacement with the shorter " for each ".

How do I enable the K&R indentation style?

We use hotkeys: Ctrl + Alt + L. More details in the article "Code style and formatting".

Where should I put it in the options so that the result of the task is displayed on the screen, and not saved to the console and file, respectively?

An option in the Run/Debug Configurations window has been changed .
  1. There is a drop-down list in the upper left corner of the screen (to the left of the green triangle). Click and select Edit configurations .

    IntelliJ IDEA FAQ - 7
  2. Then select the Logs tab . Uncheck the box next to Save console output to file .

    IntelliJ IDEA FAQ - 8

After reinstalling IntelliJ IDEA and the plugin, will my progress and subscription be saved?

Your progress and subscription are tied to a secret key ( JavaRushPlugin.properties file ). There won't be any problems. If you want to keep all the solutions, just don’t delete the project, and you can safely reinstall the rest.

After compilation, instead of Cyrillic it shows question marks/unclear symbols, what could be the reason?

Encoding problem. Problems arise when the output is in UTF8, and the input is in WIN1251 (for example).
  1. Open the File > Settings panel and enter Encoding in the search bar . We set Project Encoding to UTF-8 .

    IntelliJ IDEA FAQ - 9
  2. I'm restarting and clearing the IDEA cache . File panel > Invalidate Caches/Restart

For those who know English, there is a good article on the topic of encodings

How can I make the code line numbers immediately displayed when starting IntelliJ IDEA?

Line numbering can be enabled in two ways:
  1. Right-click on the empty one to the left of the code (see screenshot below) > Show line numbers .

    IntelliJ IDEA FAQ - 10
  2. Open the panel File > Settings > Editor > General > Appearance. Check the Show line numbers checkbox.

    IntelliJ IDEA FAQ - 11

What needs to be done for shift selection to work? Ctrl+c and ctrl+v don't work

It looks like the Vim plugin is installed. You need to disable the plugin:
  1. File > Settings (Ctrl+Alt+S)

  2. Plugins > Search -> vim (in search)

  3. Remove the checkbox. Ok. Restart .

    IntelliJ IDEA FAQ - 12
Comments
  • Popular
  • New
  • Old
You must be signed in to leave a comment
This page doesn't have any comments yet