Downloaded PyCharm and now Java is broken in IntelliJ - intellij-idea

Like the title says, I downloaded Pycharm and now my Java project in Intellij is broken. IntelliJ was totally fine beforehand. I know have errors in every file in random places. I also had errors on java imports such as "import java.util.List", (resolved now, see below).
In IntelliJ, I went to File > Project Structure and saw that the SDK was set to Python 3. I changed that JDK 1.8 that I already had set up. That resolved the import errors but I now have weird methods that can't resolve such as concat() or orElse().
Any ideas??

To fix this, I had to right click on the pom file and click "add as maven project"

Related

IntelliJ Cannot resolve symbol 'String' when using IBM JDK

The similar issue was report in this post without any solution.
--
My IntelliJ Version is IntelliJ IDEA 2022.1.2 (Community Edition)
For over an year, I have been working on a maven project which uses a customized ibm-jdk8 and a customized maven installation.
So I've configured global maven runner & import settings & project & module SDK settings to use this custom JDK.
All this setup had been working fine for over an year.
Yesterday, I updated IDEA to newer version, I'm not sure what was the reason but I started getting wired IDE errors.
So I invalidated the cache and restarted the IDE,
When that did not solve the issues, I manually deleted following folders
All ~/AppData/*/JetBrains folders .
.idea folder inside project root.
project-name.iml file inside project root.
After that I updated all intelliJ setting same as above, but
Since then I've been getting Cannot resolve symbol 'String'
Strangely all other JDK classes are detected, but in whole code String is not working.
It's a known issue specific to IBM JDK.
The workaround is to manually add vm.jar file from JDK_HOME\jre\bin\default\jclSC180\vm.jar to the SDK classpath tab in IntelliJ IDEA.

IntelliJ IDEA Ultimate with Play Framework 2.6.7 Java imports 'symbol not resolved'

Be it an example project, freshly downloaded from Play Framework's website, or my project which is derived from that with a few changes to templates - nothing big - IntelliJ just can't seem to find the appropriate dependencies or sources necessary for Play development.
I've already installed Scala plugin for IntelliJ, which includes support for Play Framework. I'll outline the process that I've followed, after reading multiple articles from Play's documentation as well as questions asked on here though no answer has proven incredibly useful as yet.
Open Project Settings within IntelliJ IDEA Ultimate 2017.2.6
Click Modules > [+] > Import Module
Find build.sbt within project root
Import with default SBT settings:
Download: [checked] Library sources, [checked] SBT source
[unchecked] Use SBT shell for build and import (requires sbt 0.13.5+)
Project JDK: [9.0 (java version 9.0.1)] -- Could this be the problem? (compatibility)
SBT compiles and I get this error, which I somewhat dismissed but reading it now seems to be somewhat telltale but I am unsure of what: https://pastebin.com/tXbHQdek
Running the site works, using sbt run, but when opening .java sources, IntelliJ marks errors upon import play.mvc.* though import views.html.* works fine. Adding framework support for Play 2.x seems to do next to nothing, as no project settings seem to change, and the error is not resolved.
This behavior exists with a clean IntelliJ 2017 Ultimate install (as of today) and an example project from Play Framework with no modifications, so if a solution cannot be found I'll probably consider posting an issue on one or more of their issue trackers.
Any ideas on how to get my Play Framework development environment working?
Thanks :3
This did not originally occur to me but in my search through the Play Framework Google group, I found a suggestion on a somewhat recent post to uninstall Java 9 as Play's dependencies are not yet compatible with it and hence won't resolve.
For anyone who might come across this issue, hopefully this saves you some days headbanging:
Optional - Uninstall JDK and JRE 9
Install JDK 8 (comes with JRE)
From within IntelliJ, File > Project Structure > SDKs > [any Java 9 JDK] > [-]
[+] > `Find your JDK 8 installation folder
32 bit: C:/Program Files (x86)/Java/jdk****/
64 bit: C:/Program Files/Java/jdk****/
Where **** is your Java version, such as 1.8_152, as in jdk1.8_152
Press OK. You'll get a warning that the project SDK is missing or similar, so click the link it provides you to configure that and select your newly configured JDK.
Everything should work from there, just straight away after IntelliJ indexes, which can be tracked in the bottom right corner as with all other operation progress.

IntelliJ doesn't show project structure correctly

I followed instruction from following link to create a Play project in IntelliJ but IntelliJ doesn't show correct structure.
https://www.jetbrains.com/help/idea/getting-started-with-play-2-x.html
Snapshot attached
I ran into the same issue and found this: Building a Play 2.6 project from IntelliJ builds nothing
So now we're 3 people with the same problem. I haven't found any open bug report or issue anywhere.
I got it working using the workaround that OP from the other question suggested: "Build the project from SBT in your desired location first, and then import the project from IntelliJ as an SBT project and you should be good to go."
To do that just run sbt new playframework/play-scala-seed.g8 (assuming you have SBT installed and PATH configured), and import that.
I raised the issue with IntelliJ support. It seems to be fixed in the latest release of IntelliJ ultimate edition. If you run the default application and see 'no jdk error', go to edit configurations and select the top level project in play module (see pic)

IntelliJ IDEA is not finding Play Twirl templates (sometimes)

I'm developing a Play Java 2.4.x application that's pretty much following all the Play conventions.
When viewing the project in IntelliJ IDEA Ultimate, the Twirl templates are usually marked as "cannot resolve symbol" in the import statements. Sometimes and inexplicably (to me), they will show up ok.
I can ctrl-click on any of the templates and IDEA will show me the compiled Scala file. Even if they are marked as "cannot resolve"
For instance, this screenshot shows a few templates as ok, but others not:
The templates are in /app/views/**.scala.html
Twirl compiles them to /target/scala-2.11/twirl/main/views/html/**.template.scala
And Scala compiles them to /target/scala-2.11/classes/views/html/**.class
I am running IntelliJ IDEA Ultimate 2016.3.4 with Playframework support plugin version 1.0
sbt run works perfectly fine on this project and has never complained about the missing templates.
Here is my sources configuration (most of that seems to be autogenerated, I've tried cleaning it up, but something keeps adding all the ones in red back in)
There is an open bug which looks like your problem:
SCL-10578 2012.2: Cannot resolve symbol on twirl template import

Inspecting code on a non-java IntelliJ IDEA project

I'm using IntelliJ IDEA to build a non-java project, it is just a PHP + Javascript project, everything is working just fine but when I try to Inspect all the code in the project (Analyze -> Inspect Code) I get an error:
The JDK is not configured properly for this project. Inspection cannot proceed.
Am I doing something wrong? Do I have to configure an SDK even though the project is not java?
Note: The automatic code inspection for working files opened in the editor is working fine, the only problem is when I try to inspec all the code in the project.
Note 2: I cannot use PHPStorm neither Webstorm.
Thanks.
In my case, I didn't wanted to delete the module since I have a bunch of stuff configured (data sources, dictionaries, http requests) and a lot of code in the shelf (which I believe it's stored along the project/module). I found that you can skip the "delete your module" part and instead just update the module config:
Find the $module.iml file (in my case it's inside the .idea directory) and at the top there's was a line:
<module type="JAVA_MODULE" version="4">
which I changed to:
<module type="WEB_MODULE" version="4">
The issue was fixed and I haven't seen any side-effects but, just in case, you might want to backup the .idea directory.
I raised this over at https://youtrack.jetbrains.com/issue/IDEA-188017 - after some back and forth, the Jetbrains employee helped me figure out that I had a Java module in there.
If you are not using Java, please crate a module of a Static Web type. Now you have a module of a Java type, that is why the error is reported, so such behaviour is expected.
Delete your Java module.
Once you enter in the menu in the screenshot below, find the Static Web type and create your module like that.
Seems like adding a SDK the code analyzer works just fine, even though the project has no single java module.
Maybe it is a bug, so I will report it.
My project's .idea/<project>.iml file had an entry:
<orderEntry type="inheritedJdk" />
I quit Idea, removed the line above from the iml file, restarted Idea and the next Inspection ran without any issues.
I recently ran into this issue with my purely Python project.
After much frustation, I bumped into a rather bizarre solution:
When IntelliJ complained that JDK is not configured, in the following dialog box, I just selected JDK8 (instead of Python 3.7.2 path) and viola! its gone.
My environment was
IntelliJ IDEA 2018.3.4 (Community Edition)
Build #IC-183.5429.30, built on January 29, 2019
JRE: 1.8.0_152-release-1343-b26 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.2