cannot find symbol "var" in Intellij Idea - intellij-idea

Whenever I try to run my application from Intellij Idea I get the following error..
If I build the application via Maven it works fine.
Take a look at my module settings the JDK is v10, the language is v10 as well for both the project and module.
Any idea why this would be happening?

I have no idea how this ever got set wrong but I had the Java compiler bytecode version settings set wrong in the IDE preferences...

Related

Problem in running a project with aspectJ in IntelliJ IDEA 2022.2.3 (Community Edition)

I am trying to run a project with aspectJ, rather than Java, in IntelliJ IDEA. I had done it before by simply putting "aspectj-1.9.6" in a "Lib" folder and setting the folder "as Library". But I tried it again today and it is not working. I think it might be because I have updated my IntelliJ to version "2022.2.3". I saw in this link that for intelliJ version "2021.1", one should select "ajc" as the project compiler in IntellJ. But it seems that there is no such compiler option in IntelliJ version "2022.2" (as I looked at this link and also searched in this link).
I also tried to install and enable "AspectJ weaver" plugin, but I encounter the following error: "Plugin 'AspectJ weaver' failed to initialize and will be disabled. Please restart IntelliJ IDEA.". Someone has had the same problem in this post, but the answer doesn't work for me, as it refers to this link, which is not compatible with IntelliJ version 2022.2.3:
So, I wonder whether aspectJ is not supported any more in IntelliJ?
Does any one has any suggestion that I could use it with this version of IntelliJ? I do really appreciate any help.
Thanks in advance
IntelliJ IDEA is compatible with AspectJ. I am running the plugin on 2022.2.3 without any problems. But I use IDEA Ultimate, you use Community. Did you notice this in your screenshot?
Compatible with IntelliJ IDEA Ultimate

How to add a break point in Intelij IDEA to debug Rust code

I have installed Intellij IDEA on ubuntu with Rust plugin.
How to add a break point in Intellij IDEA to debut RUST code.
Do I need any additional plugin?
Debugging Rust code is available in CLion, IntelliJ IDEA Ultimate, PyCharm Professional, and GoLand. For IntelliJ IDEA Ultimate, PyCharm Pro, GoLand it is required to install the Native Debugging Support
plugin.
See plugin's documentation for more information: Debugging.
no need for extra plugins just add them like you would do in java (left click right of the number). but in order to debug (apply them) you'll need Native Debugging Support (i believe the ide autosuggests this plugin on the first debug run)

IntelliJ error - could not open init generic class cache for initialization script

enter image description here
enter image description here
I was trying to download IntelliJ and learn Kotlin, but i get a BUG error before i am starting, and i dont now what to do..
I have try to delete the scipts folder, but it just make a new scipts folder, and say the same error. I have also reinstall IntelliJ, and thats give the same error.
Is der someone there can help me? :-)
Could not open init generic class cache for initialization script 'C:\Users\username\AppData\Local\Temp\wrapper_init4.gradle' (C:\Users\username.gradle\caches\6.6.1\scripts\3yb5naxddghzghazzdf2vk0em).
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 60
As per the details in your error message, you can see that the root cause is a gradle error.
Gradle is likely using an unsupported version of the JVM in your case (e.g. I could reproduce the error in the latest IntelliJ 2021.3 version where gradle was using JVM 17 from my home path, while the IDE itself was using JDK 11.) In the attached IntelliJ Preferences screen, note that the JVM used by Gradle is specified separately.
To fix the error, verify the JVM version being used by gradle and specify a JVM 11 version to gradle.
IntelliJ Gradle Preferences Screenshot:
You should set these options when you create your project enter image description here
Or, when creating a project, choose Java - Kotlin\JVM
For me this problem occurred when i was using wrong JDK file to build the project that is the Gradle JDK used was a normal SE JDK rather than one preferred by Android Studio so you follow the following steps to solve it.
Go to Settings (ctrl + alt + s)
Go to Build,Execution and Deployment
Then select Build Tools > Gradle
Change Gradle JDK to jbr-17 (the one i am using) you can prefer to choose options from Android studio Java Home or Default JDK

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

Using IntelliJ to compile Java 7, configuration trouble

I am playing with IntelliJ and trying to get it to work with Java 7.
My JDK is set up to point to latest JDK
Additionally, project is set to use it as well
Yet, when trying to write Java7 code, it's syntax is not being recognized.
What am i missing please?
Set the Project Language Level to 7.0. Reload the project when asked: