I recently downloaded IntelliJ IDEA to a different computer. On one computer it works fine on the other computer it is giving me this current issue.
When i open a new project with a template it automatically shows errors everywhere even though it allows the code to run and shows the output correctly: standard Java library classes like String
and System
are highlighted in red and the error tooltip says: «cannot resolve symbol».
I have tried «Invalidate caches/Restart», but it didn’t help.
CrazyCoder
386k170 gold badges980 silver badges894 bronze badges
asked Apr 13, 2020 at 1:22
Check the JDK configuration Classpath tab in Project Structure | SDKs:
Also check that project and modules use the same JDK.
If it’s empty, remove the JDK and add it again. It’s not recommended to use JetBrains Runtime as your JDK, download and configure some different standalone JDK instead, 2020.1 version can download JDK for you.
Important notice
The bundled JRE is used for running the IDE itself,
and it’s not sufficient for developing Java applications. Before you
start developing in Java, download and install a standalone JDK build.
answered Apr 13, 2020 at 1:32
CrazyCoderCrazyCoder
386k170 gold badges980 silver badges894 bronze badges
0
I tried above, but no luck. I did get it working with File -> Invalidate Caches…
I selected all three checkboxes and then «Invalidate and Restart». That worked for me.
answered Apr 14, 2021 at 11:02
BBNKSRBBNKSR
711 silver badge1 bronze badge
1
Often this means there is an issue with your java compiler. Normally this issue arises on an initial Intellij install. You can install/update the java compiler to get it working properly.
Go to the editor and type Ctrl + Alt + Shift + A
. Then, a little bar pops down and you can select to either install the compiler, or configure it. Both times this happened to me, I just clicked install and once it was done, everything worked. If the install doesn’t work, you can just reconfigure your compiler.
answered May 21, 2021 at 14:20
JeremyJeremy
1,01811 silver badges34 bronze badges
Removing the Java SDK and adding it back under File->Project Structure did it for me.
answered Nov 11, 2021 at 4:48
The only thing that worked for me (after hours of trying!) was to use the Android Studio’s embedded JDK. «Invalidate caches/Restart» did not solve the issue, even using the same JDK version which was not coming with Android Studio was giving the Cannot resolve symbol 'String'
errors. Wonder what’s so special with this pre-packaged JDK! Hmmm
answered Feb 26, 2022 at 18:56
doctorramdoctorram
1,05214 silver badges13 bronze badges
For me the solution seems to have been creating a new Run Configuration.
I had tried deleting the SDKs, and re-adding the one I needed but that did not clear the error. But creating a new Run Configuration did the trick.
answered Jun 27, 2022 at 19:25
cptullycptully
5571 gold badge6 silver badges24 bronze badges
I had this problem when I uninstalled JDK and re installed it, and when I was making a new project I had the uninstalled JDK file selected, which somehow caused the system to be in red and un run-able.
answered Nov 26, 2022 at 0:21
2
JavaRush — это интерактивный онлайн-курс по изучению Java-программирования c нуля. Он содержит 1200 практических задач с проверкой решения в один клик, необходимый минимум теории по основам Java и мотивирующие фишки, которые помогут пройти курс до конца: игры, опросы, интересные проекты и статьи об эффективном обучении и карьере Java‑девелопера.
Подписывайтесь
IDEA начала подписывать все переменные типа string. При компиляции выдаёт приблизительно следующее Cannot resolve a symbol ‘string’. JDK подключен, на всякий случай переустановлен. Работает.
-
Вопрос заданболее трёх лет назад
-
9702 просмотра
How to fix IntelliJ cannot resolve symbol
Thursday 08, October 2015 | Post link
Ever since copying a Gradle project from one computer to another I have been getting ‘cannot resolve symbol String’ and similar messages in IntelliJ. Listed below are steps which *may* fix the problem:
-
Invalidate and refresh the IntelliJ’s caches
File Menu -> Invalidate Caches / Restart -
Project SDK selection
Check project settings from File Menu -> Project Structure
Ensure an SDK is selected for the Project SDK. If is selected, click the ‘New’ button, select JDK and then select the correct path to the JDK e.g. /opt/java/jdk1.8 or c:JavaJdk1.8
- Corrupt JDK
There may be a problem with your JDK installation, re-install JDK -
Re-import the project
Close the project if it is open in IntelliJ
Delete the .idea folder in the project source code folder.
Start IntelliJ and Import the project.
triatri3 11 / 12 / 8 Регистрация: 16.11.2016 Сообщений: 892 |
||||
1 |
||||
04.02.2020, 08:05. Показов 5663. Ответов 4 Метки нет (Все метки)
Выводит ошибки везде, где встречаются string’и. Что не так?
0 |
2442 / 1898 / 475 Регистрация: 17.02.2014 Сообщений: 9,155 |
|
04.02.2020, 08:17 |
2 |
Что не так? не string, а String))
1 |
triatri3 11 / 12 / 8 Регистрация: 16.11.2016 Сообщений: 892 |
||||
04.02.2020, 09:00 [ТС] |
3 |
|||
Большое спасибо.
0 |
Модератор 35598 / 19496 / 4074 Регистрация: 12.02.2012 Сообщений: 32,533 Записей в блоге: 13 |
|
04.02.2020, 09:40 |
4 |
Сообщение было отмечено triatri3 как решение Решениеtriatri3, у тебя конструктор класса (стр.6) требует первым параметром int, вторым — String. А при вызове (стр. 18)? почитай Обрати внимание на п.2 и 3
2 |
2442 / 1898 / 475 Регистрация: 17.02.2014 Сообщений: 9,155 |
|
04.02.2020, 09:57 |
5 |
0 |