SBT project refresh failing in IntelliJ IDEA with "Access is denied" error - intellij-idea

I have recently migrated a Scala project over to IntelliJ IDEA (v13.1.4) from Eclipse, and I'm seeing an unusual error when I start IDEA:
SBT 'myproject' project refresh failed:
Error: Cannot run program "C:/Program Files/Java/jdk1.8.0" (in directory "C:\src\myproject"): CreateProcess error=5, Access is denied
CreateProcess error=5, Access is denied
Everything seems to work OK otherwise, and I have no problems executing SBT manually from the command line.
I'm running the idea64.exe executable on Windows 7 Professional 64-bit, with a Java 8 64-bit JDK that is installed in C:\Program Files\Java\jdk1.8.0.
I have also configured the IDEA_JDK_64 environment variable to point to this Java 8 JDK (with the value C:\Progra~1\Java\jdk1.8.0, so that it contains no spaces); JAVA_HOME is set to the same value, and the JDK is also included on my Path (as %JAVA_HOME%\bin). The project itself is configured to use the same Java 8 JDK.
However, the error appears to indicate that IDEA is trying to execute the jdk1.8.0 directory, rather than a program within the JDK installation.
Any suggestions for why I'm seeing this error?

As you might know, I think it is a bug of Scala Plugin.
This bug has been fixed already.
https://youtrack.jetbrains.com/issue/SCL-7481

Related

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

Netbeans 8.2 doesn't start

I just installed Netbeans 8.2 with the JDK package. When I open the exe file nothing happens. Looking at the task manager I notice the netbeans service starting then stopping. I tried typing in the --trace command in the command prompt but don't see anything useful for me to fix.
I had the same problem because two JDK versions were installed on my pc, so changing the Netbeans needed JDK to lower version solved my problem. here are my passed steps:
Step One
In your Netbeans home directory (for example, C:\Program Files\NetBeans 8.1), open up the netbeans.conf in the etc directory (C:\Program Files\NetBeans 8.1\etc\netbeans.conf).
Step Two
There is a property called netbeans_jdkhome. Change the value to match the JDK you want Netbeans to use (for example, C:\Program Files\Java\jdk1.8.0_161).
Step Three
Save your changes (user must be Administrator)
Step Four
Restart Netbeans
i had the same problem. i solved it by reinstalling JDK. but at first i had two applications that were using JDK (intellij and netbeans) when i uninstalled the intellij the netbeans started to show the problem of starting in task manager and failing on loading the modules.
Some policies in the Network where now I am working changed, so I started NetBeans as Administrator and the problem was solved.

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

Compile Erlang in Intellij

I try compile erl files in Intellij with Erlang plugin. Everything is good with compilation but in out/production the folder does not create any files .beam and when I run console I get message:
exception error: undefined function.
When I use c("file"). everything is all right. Why does Intellij not create .beam files?
Try to fix it by going to Preferences -> Build, Execution, Deployment -> Erlang Compiler and check "Compile project with rebar".
Also, verify that rebar is installed and configured in IntelliJ by going to Preferences -> Other Settings -> Erlang External Tools and specifying the path to the rebar installation.
I was having the same issue ..
The problem is very strange erlang plugin doesn't compile and copy the files to out directories meanwhile if you compiled from terminal or command prompt (windows) it is working fine. this issue arose after installing IntelliJ Idea v 15.
What I have done here to fix the issue:
Uninstall Intellij Idea v 15
Downgrade IntelliJ Idead to version 14.1.4
Install Intellij Idea again (v. 0.5.11)
Configure SDK to reference src of erlang language.
Create a new test project and start making the project again .. it should work fine...
Hope this helps you

gradle doesn't work in Intellij - problems with JAVA_HOME

I can run gradle from a command line to see its version.
I can run, compile and debug a grails app in IntelliJ (version 10.0 or version 10.2)
I installed the IntelliJ Gradle Plugin.
Whenever I try to do anything with gradle from within Intellij I get an error as follows:
Executing command: "tasks"
Failed to connect to gradle process for command 'tasks'
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
But in my environment I have JAVA_HOME set to the proper JDK in a different directory. Plus when I look in IntelliJ for the project, it also shows the JDK in the proper JDK location. I cannot find anything that attempts to point the JDK to the Intellij JRE location.
Any ideas please?
IntelliJ uses its own jre.
to force IntelliJ to use it, you need to set the environment variable IDEA_JDK to point to your JDK.
then simply restart intellij and gradle gui plugin should now work.
Man I had so much trouble with this as well, and I don't remember having this much trouble before. I think they changed something. Here are the incantations which got it working for me on Mac OS X 10.11.5, both with Java and Gradle on IntelliJ 2016.1
Here's the summary: install the latest Java JDK from Oracle, add the java_home value to $JAVA_HOME and set that value to $IDEA_HOME (IntelliJ's variable for defining which JDK to use), install gradle (optional) using homebrew, then define the project SDK in IntelliJ.
Here it is broken down from the very beginning of a clean install:
1. Download Java from Oracle's Download Page
2. Use homebrew to install gradle
IntelliJ ships with its own version of Gradle, so this is really optional, and is helpful if you want to use Gradle outside of IntelliJ.
`brew update && brew install gradle`
3. Set the env variables
Paste the following into ~/.profile. These values will work regardless of which version of java or gradle you have installed. Don't set the GRADLE_HOME if you didn't install the standalone gradle.
export JAVA_HOME=$(/usr/libexec/java_home)
export IDEA_JDK=$JAVA_HOME
export GRADLE_HOME=/usr/local/opt/gradle/libexec
4. Set the environment variable to occur at application launch so that IntelliJ sees is using OS X's launchctl program:
launchctl setenv JAVA_HOME $(/usr/libexec/java_home)
5. Define the project SDK
Use the project settings window in IntelliJ to define the project SDK (I don't see this option anywhere else in the global IntelliJ preferences window, this has to be done in the project settings).
6. Wait for the indexes to update, then close and re-open IntelliJ. You should now be able to build the program.
if you are using Intellij version 10.x you should not install any Plugin to run a gradle script.
All you have to do is to go to the Gradle setup (File -> Settings -> Gradle) and set the Gradle Home folder (the location of your Gradle installation, eg. C:\tools\gradle).
You should be able to select a Gradle build file and run it.
Point your JAVA_HOME to JDK, not to JRE.
I think this error might be caused by an install bug with IntelliJ IDEA. When I look at the installed folder referred to in the error message on my filesystem:
C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre
I see the jre folder but then another jre folder beneath that one which contains the bin and lib folders of the jre:
jre
jre
bin
lib
I copied bin and lib up a level into the first jre folder, and that fixed this error for me.