IntelliJ Idea JDK path - java

I have ubuntu 14.04, Im trying to configure IntelliJ Idea with scala, but I have problem with JDK path.
This is my configuration:
What Im doing wrong?

Hmm I installed openjdk again as I saw some less files there.
apt-get install openjdk-7-jdk
and works fine ;)

Check that the given path is pointing to JDK, not only to JRE.

Related

How to find the JRE location to use the system JRE in eclipse

I'm trying to set up a java project to use openjdk-11 and all the answers I have found so far have me going in circles. I'm using ubuntu 20.04, so I used the command 'sudo apt install openjdk-11-jre'. The installation seemed to be successful but now I can't seem to figure out the file path to the installed JRE. I thought it would be under /user/lib/jvm/java-11-openjdk-amd64 somewhere. When I point eclipse to that location and try to search for a JRE however it doesn't find anything.
I have found lots of examples with info on how to install but nothing about how to track down the exact file path. Any help would be greatly appreciated.
Update
While I was able to find the JRE location, the root problem turns out to be eclipse. I forgot I had an older version (4.6) open since that is what the project was originally using. Once I switched over to 4.18 I was able to add the java 11 JRE.
Using which will give you /usr/bin/java which won't help as it will be a symlink. You need something like
readlink -f $(which java)
you can use the following:
update-alternatives --list java
will gives you something similar to the below:
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

"Cannot run program "cmd"" java maven quote [duplicate]

I've a fresh install of netbean 11.1.
Now I'm trying to build a project but I get the following error output:
Cannot run program "cmd" (in directory "C:\projects\open"): Malformed
argument has embedded quote: "C:\Program
Files\NetBeans-11.1\netbeans\java\maven\bin\mvn.cmd"
cd C:\projects\open; "JAVA_HOME=C:\\Program Files\\Java\\jdk-11.0.5" cmd /c "\"\"C:\\Program Files\\NetBeans-11.1\\netbeans\\java\\maven\\bin\\mvn.cmd\" -DskipTests=true -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans-11.1\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 clean install\"" Cannot run program "cmd" (in directory "C:\projects\open"): Malformed argument has embedded quote: "C:\Program Files\NetBeans-11.1\netbeans\java\maven\bin\mvn.cmd" -DskipTests=true -Dmaven.ext.class.path="C:\Program Files\NetBeans-11.1\netbeans\java\maven-nblib\netbeans-eventspy.jar" -Dfile.encoding=UTF-8 clean install
I've build this project with netbeans 11.1 before but have a new pc.
and a fresh install, tho I'm sure there was no problem last time I tried to install everything.
Although this problem can be fixed by installing jdk1.8.0_221, but actually you don't need to downgrade your JDK. Just try these:
First exit netbeans IDE if it's open, then open netbeans configuration file from here: netbeans-Install-Dir/etc/netbeans.conf
(Note: for me netbeans-Install-Dir is C:\Program Files\NetBeans 8.2\etc)
Add the below arguments
-J-Djdk.lang.Process.allowAmbiguousCommands=true
to the beginning of the string that you find at this line:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m ......."
Sample screenshot as shown below:
4. Save the change and start your netbeans IDE.
I have checked the release notes for JDK 13.0.1 at https://www.oracle.com/technetwork/java/javase/13-0-1-relnotes-5592797.html#JDK-8221858
This behavior is a regression from a security fix for JDK-8221858 (not public). Follow the link for a full description. The fix is part of JDK 8u231, JDk 11.0.5, 13.0.1 etc.
To resolve this problem, append -J-Djdk.lang.Process.allowAmbiguousCommands=true to netbeans_default_options in <netbeans-dir>\etc\netbeans.conf.
I had this error with adopt8-hotspot (AdoptOpenJDK-1.8.0_232-b09) and sbt-0.13.X for an old project.
Problem solved after setting the environment variable in windows via
set JAVA_TOOL_OPTIONS=-Djdk.lang.Process.allowAmbiguousCommands=true
Did you by any chance install the latest critical update for java? jdk 1.7_241? I installed that today and was having the exact same problem. I downgraded my jdk version and it solved it completely.
EDIT: Apologies, I noticed you're using netbeans 11.1 so you probably have a later java version, in any case, you could try downgrading your java version to a previous release if you happened to update it today as the other version might have the same problem.
At the time that I'm writing, I had only JDK13 installed only on my machine. After unzipped my netbeans I've got the same problem with the internal maven of my netbeans 11.1.
Apparently netbeans 11.1 does not work properly with the JDK13. I just installed the JDK 8 and the problem now is solved, without any additional configuration or parameter change.
Nontheless, since I need the JDK13, I have both installed but my netbeans.conf file is pointing to JDK8. Later, you can define the new Java platform in netbeans project configuration.
I hope this might help.
Cheers!
just add -J-Djdk.lang.Process.allowAmbiguousCommands=true to netbeans_default_options in netbeans.conf
It seems to happen with all recently released jdk version (11.0.5 and 13.0.1 at least), even with the latest Netbeans 11.2vc1 (and witnessed on NB 11.1 too).
Downgrade your jdk to 11.0.4 or 13.0.0. It fixed the issue for me
The problem also occurs in version jdk-8u231. Fixing installing jdk-8u221 version
Apache NetBeans 11.1 does indeed not support JDK 13, that's what the upcoming Apache NetBeans 11.2 is for -- latest beta: bit.ly/apache-netbeans-11-2-beta-3
I had the same problem with oracle jdk 13.0.1 and netbeans 11.1, but it worked for me with openjdk 13.0.1 (https://jdk.java.net/13/).

Path JRE on VSCode MacOS

What is the correct path of JRE8 that I put in sonarlint.ls.javaHome in VSCode in MacOS so that it works correctly?
I have tried this:
\\Library\\Internet Plug-Ins\\JavaAppletPlugin.plugin\\Contents\\Home\\bin
/Library/Internet\\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/
Install JDK and set "/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home" in VSCODE settings under sonarlint.ls.javaHome
Ok, I have the same issue and there is one important message: you must use JRE8 and not the newest version of JRE (e.g. JRE 10) for the plugin "SonarLint" (sonarsource.sonarlint-vscode). With JRE9 or newer it doesn't work!
This path worked for me:
"sonarlint.ls.javaHome": "/Library/Internet PlugIns/JavaAppletPlugin.plugin/Contents/Home"

IntelliJ can't find tools.jar without sudo

I'm trying to run IntelliJ on Ubuntu 14.04. I've read this question but the solutions don't apply -- I've definitely got the JDK installed rather than the JRE. When I try to run idea.sh, I get the error message:
'tools.jar' seems to be not in IDEA classpath. Please ensure JAVA_HOME
points to JDK rather than JRE.
JAVA_HOME is set to /etc/java-7-openjdk. Eclipse (in the form of Eclim) has no problem finding it. javac -version prints javac 1.7.0_55.
However, if I run sudo ./idea.sh, IntellJ launches fine. What am I missing?
I had the exact same problem half an hour ago. Took me exactly that half hour to fix it, this is how it worked for me:
Short version:
add
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
to your .bashrc, source it and you are fine.
Explanation:
After installing the JDK in Ubuntu there are multiple folders on your disk.
The root folder is
/usr/lib/jvm/java-7-openjdk-amd64/
under which the aforementioned /jre -Folder resides.
The whole problem is, that the jre/lib -Folder does not contain the tools.jar - File searched by the IDE.
Only the /usr/lib/jvm/java-7-openjdk-amd64/lib - Folder does.
To get everything working you have to specify /usr/lib/jvm/java-7-openjdk-amd64 as JAVA_HOME.
Setting /usr as your JAVA_HOME wont solve the problem as that is symlinked to /etc/alternatives which is symlinked to our old friend the /jre-Folder.
I hope this helped you!
In the 64 bit Debian 7, I solved the problem by adding this two lines of code in idea.sh under the /path/to/intellij-folder/bin/
export IDEA_JDK=/path/to/jdk/
export JAVA_HOME=/path/to/jre
And I hope it will solve the problem in Ubuntu.
It turns out JAVA_HOME was set wrong, I needed to set it to:
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
to get it working. I'm not sure why this hadn't caused me any problems before.
EDIT: This setting makes Maven angry (although Maven via IntelliJ works fine). For future readers, I believe the correct setting is:
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre/
you can change your current java version as follows
alternatives --config java
alternatives --config javac
but before them you need to install your newly installed JDK in alternatives properly:
alternatives --install /usr/bin/java java [new-jdk-path]/bin/java 120 --slave /usr/bin/rmiregistry rmiregistery [new-jdk-path]/bin/rmiregistry --slave /usr/bin/keytool keytool [new-jdk-path]/bin/keytool --slave /usr/lib/tools.jar tools.jar [new-jdk-path]/lib/tools.jar
alternatives --install /usr/bin/javac javac [new-jdk-path]/bin/javac 120 --slave /usr/bin/jar jar [new-jdk-path]/bin/jar --slave /usr/bin/rmic rmic [new-jdk-path]/bin/rmic

NetBeans hangs on attempting to use "find usage"

Netbeans version tried: 7.3 and 7.2.1
OS: Ubuntu 12.04
Java Version: 1.6.0_27
I am getting weird problems using NetBeans. The problem in the title is one out of many, and maybe they are all related.
To resolve this problem, I just like to know if anyone else is encountering the same/similar problem in the environment described. Can anyone provide any resolution to the problem(s)?
Just rollback for jdk packages:
sudo apt-get install openjdk-6-jdk=6b24-1.11.4-3ubuntu1
sudo apt-get install openjdk-6-jre=6b24-1.11.4-3ubuntu1
sudo apt-get install openjdk-6-jre-headless=6b24-1.11.4-3ubuntu1
sudo apt-get install openjdk-6-jre-lib=6b24-1.11.4-3ubuntu1
This was a JDK issue. I resolved my problem by updating to latest JDK.
Maybe not the cause in your case but I found this, having the same issue on Mac OS with Netbeans 8.0.2: https://netbeans.org/bugzilla/show_bug.cgi?id=236101
They say it's a bug in JDK 7u40.
I can confirm that installing JDK 8 fixes this.

Categories

Resources