How to know what JDK IntelliJ IDEA is using - intellij-idea

I have looked at:
https://intellij-support.jetbrains.com/hc/en-us/articles/206827547-Selecting-the-JDK-version-the-IDE-will-run-under
and
https://intellij-support.jetbrains.com/hc/en-us/articles/206827537-Configuring-JVM-options-and-platform-properties
How can I know what version and path of JDK my IntelliJ IDEA is using?
I have tried setting the environment variable IDEA_JDK.
But I am not sure which version of JDK the IDE is picking up. is there a log I could see to verify this?
System information
IntelliJ-IDEA 15
Windows 7, 64 bit

Please look at the https://intellij-support.jetbrains.com/hc/en-us/articles/206827517-Locating-IDE-log-files to locate the log file which has the command used to start Intellij IDEA
For example, on OSX, ~/Library/Logs/IntelliJIdea15/idea.log has the following:
2015-10-17 16:26:52,339 [ 1086] INFO - #com.intellij.idea.Main - JRE: 1.8.0_40-release-b94 (JetBrains s.r.o)
2015-10-17 16:26:52,339 [ 1086] INFO - #com.intellij.idea.Main - JVM: 25.60-b23 (OpenJDK 64-Bit Server VM)
2015-10-17 16:26:52,378 [ 1125] INFO - #com.intellij.idea.Main - JVM Args: <snip>
If you don't have the Help -> Show log in explorer option, then please search for the file at c:\Users\Auyshman\.IntelliJIdea15\system\log\idea.log
Another alternative is to use Process Explorer and add/enable the column called 'Image Path' to see the complete path of the process for Intellij. This should show the JDK/JRE being used to invoke Intellij as well.

Default locations
On the Mac, the default location is:
/Applications/IntelliJ IDEA <version>.app/Contents/jdk/Contents/Home/jre
On Windows, the default location is:
C:\Program Files\JetBrains\IntelliJ IDEA <version>\jre64
(Does anyone know what the default location is on linux?)
If these default locations do not work, here are two ways to find out the actual location:
Method #1
Go to Settings → Build, Execution, Deployment → Build Tools → Maven → Runner
Open the "JRE:" dropdown list
Select the "Use Internal JRE" entry.
Look at the path. (It will probably be abbreviated, so you will probably have to divine it.)
Method #2
Execute the "Find Action..." action. The default key binding for this action is Ctrl+Shift+A. This brings up a dialog where you can type the name of any action to find it and execute it.
In the dialog that opens, type "Switch" and from the suggested matches select "Switch Boot JDK...". This will execute the "Switch Boot JDK..." action for you, which is not bound to any key by default and it cannot be found in any of the menus.
In the dialog that opens you can see the currently selected "Boot JDK". There is even a button to copy the path to your clipboard.
P.S.
I find it amazing that IntelliJ IDEA does not seem to readily provide this information. Every time I install a new version of IntelliJ IDEA I have to go to the IntelliJ IDEA JRE and execute the keytool to install a certificate into this new JRE so that it can access the internal maven repositories that we use. So, every time this happens, I need to know where the internal JRE is. And I usually have to do it both for the mac at work and for windows at home, which is quite tedious.

JVM version and name (but not path) is visible in the Help->About dialog.

Related

How to get WSL2 working with IntelliJ IDEA 2021.1

I have no idea how to get IntelliJ IDEA 2021.1 working with WSL. I spent two days searching trough internet but I wasn't able to get it running. I am able to create new project with JDK located in WSL but when I press "play button" I receive this:
Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Cannot assign requested address: bind
Synchronizing output directories...
4/16/2021 7:57 PM - Build completed with 1 error and 0 warnings in 77 ms
What I tried was also to use maven from WSL but that also didn't help. Does anyone has idea what I am doing wrong?
Jetbrains added an option to work around the issue (has to do with your WLS2 /etc/resolv.conf being modified due to VPNs, etc.):
https://youtrack.jetbrains.com/issue/IDEA-265522#focus=Comments-27-4808360.0-0
From the issue link:
Thanks, the issue with generateResolvConf=false in /etc/wsl.conf is reproduced. The fix will be available in 2021.1.x builds, exact fix version will be available later (see "Available in" field).
After updating to a version with the fix, please do the following to change how Windows host IP is obtained:
Open "Help | Find Action...", locate "Registry..." there and open it.
In the opened "Registry" dialog, find wsl.obtain.windows.host.ip.alternatively registry key (disabled by default) and enable it.
Restart IDE to apply the changes.

GraphDB Failed to create JVM after attempting to change java options

Running GraphDB on windows.
I right clicked the icon, clicked settings. Tried to set Xmx512Mb, (so I mistyped, should have been Xmx512M). Now trying to run GraphDB says "Failed to create JVM", even after uninstalling and re installing.
Where can I find and undo what I typed in the settings if the UI is not starting up?
In other words, where is this configuration stored?
I removed AppData/Roaming/GraphDB and AppData/Local/GraphDB Free
Just to generalize it, If you set an invalid Java option parameter, GraphDB Free may fail to start after the application restart. The only way to solve this problem is to remove the invalid line from the file:
%userprofile%\AppData\Roaming\com.ontotext.graphdb.free\packager\jvmuserargs.cfg (Windows)
~/Library/Application Support/com.ontotext.graphdb.free/packager/jvmuserargs.cfg (Mac OS)
~/.local/com.ontotext.graphdb.free/packager/jvmuserargs.cfg (Linux).
In addition to Damyan's answer there is a GraphDB Free.cfg file in C:\Users\User\AppData\Local\GraphDB Free\app\ which you can edit.

IntelliJ IDEA error: cannot find vm options file

I'm trying to launch IntelliJ IDEA but the following error pops up:
Cannot find vm options file
This happened to me in Ubuntu 16.4, and the pycharm.vmoptions file was under the bin/ directory.
I was trying to run the shell script with this commands:
cd <path_to_pycharm_installation>/bin
source pycharm.sh
Running the bash script without the "source" command solved it for me:
./pycharm.sh
The explicit solution is to set an environment variable named $IDEA_VM_OPTION:
export IDEA_VM_OPTION="[path-to-'.vmoptions' file]"
Search in the file idea.sh:
grep -ri "vmoption" ./bin/idea.sh
You will see that the search path for .vmoptions file is either:
$HOME/.IntelliJIdea2016.2/idea$BITS.vmoptions
or
$IDE_BIN_HOME/idea$BITS.vmoptions
So, copy file bin/idea64.vmoptions into one of above locations if you have 64 bit JVM installed or file bin/idea.vmoptions else.
The following information is current as of April 23, 2019 for version 2019.1.1 of IntelliJ Ultimate that was installed via JetBrains Toolbox app version 1.14.5179
Locate the start menu item for IntelliJ. For me, it was at:
%APPDATA%\Microsoft\Windows\Start Menu\Programs\JetBrains Toolbox\
with the name:
IntelliJ IDEA Ultimate
right-click on the above item and choose Properties
Change the empty Start In: text box to read:
%LOCALAPPDATA%\JetBrains\Toolbox\apps\IDEA-U\ch-0\191.6707.61\bin\
Once the above work-around has been performed, IntelliJ 2019.1.1 Ultimate will stop emitting the error:
Error launching IDEA cannot find VM options file

Opening files with drag n drop in jedit for ubuntu

This may seem like a stupid question, but I really can't find a way to open files from nautilus using jedit. I tried drag n drop and it doesn't work. Couldn't find any plugins in jedit to do this either.
Alternatively, I don't mind just double clicking to open, but I can't set jedit as default text editor application since it doesn't appear in my application list for some reason. So there's no way I can open the files from nautilus.
The only way i can open at the momemnt is either within jedit or in the terminal, but these are really inefficient for me. So it would be great if anyone could give me a hand in solving this trivial problem.
I did some googling and from here http://jedit-devel.narkive.com/3Qsqp2II/jedit-devel-jedit-drag-and-drop-bug-in-gnome, seems like the versions may be affecting this issue. Not sure about this. But here are my facts
java version "1.7.0_65"
jEdit 5.1.0
How about adding jEdit to List of Applications in “Open With” When Right-Clicking Files in Nautilus?
Instructions from https://ubuntugenius.wordpress.com/2012/06/18/ubuntu-fix-add-program-to-list-of-applications-in-open-with-when-right-clicking-files-in-nautilus/
For example, this is my jedit.desktop file:
$ cat /usr/share/applications/jedit.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=jEdit
GenericName=Text Editor
Comment=Text editor for code
Exec=jedit %F
Terminal=false
MimeType=text/plain;
Icon=jedit
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=jedit
OnlyShowIn=Unity;
[Desktop Action Document]
Name=New File
Exec=jedit
OnlyShowIn=Unity;
If you want to make jEdit the default for opening the particular filetype, you can now right-click one, choose Properties, go to the Open With tab, click on jEdit under Recommended Applications, and click the Set as default button.
Hope this helps.
This should work and works just fine for me.
If you are using the version included in the Ubuntu repository, try changing to our official version in our own repository as described on our homepage.
If you are using the official version, look in your Activity Log for anything suspicious when trying to drag&drop.
Also jEdit should be available as a normal Application and for "Open with Application..." just fine, at least with our official packages.
If all does not work, open a bug in the bugs tracker, then we can maybe help you better than here.
This might be something unique to my wonky machine running Ubuntu 12.04, but I found the line JAVA="${JAVA_HOME}/bin/java" to be the problem.
From a terminal, it resolves to the correct value of /usr/lib/jvm/java-8-oracle/bin/java.
However, from the desktop or launcher bar, it resolves to /com/home/users/current/local/java.
Maybe someone more learned than I can explain this, but my solution was to edit the file at /usr/local/bin/jedit, replacing the last line:
exec "${JAVA}" -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -jar "/usr/local/share/jEdit/5.3.0/jedit.jar" -reuseview "$#"
With:
exec "java" -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -jar "/usr/local/share/jEdit/5.3.0/jedit.jar" -reuseview "$#"
This only works if the JVM is set up properly.

Glassfish 3.1.2.2 in IDEA 11.1.4: "PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required"

I am trying to get our Mavenized web application up and running in a freshly installed IDEA 11.1.4 Ultimate (Windows 7) under a freshly unzipped Glassfish 3.1.2.2. I have done this many times in Eclipse, but am not familiar with IDEA.
I can build and deploy it just fine, but when I try to access pages with JSP-content I get:
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
The Glassfish Application Servers entry adds the javax.ejb.jar, javax.servlet-api.jar and javax.servlet.jsp-api.jar as libraries.
I have set the project SDK to point to a full JDK resulting in:
(which does not seem to include a jar with javac)
The IntelliJ tutorials I've found so far, does not mention this problem. My guess would be that the "please start using this JDK" information is not passed on to Glassfish, so it just picks up the system JRE.
What configuration step have I missed? I do not want to edit configuration files - I expect the IntelliJ plugin to do this if I know how to tell it to.
I got the same notification and just changed in admin port -> Configurations -> server-config -> JVM Settings -> Java Home as "C:\Program Files\Java\jdk1.8.0_72", and it started working.
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required.
I was getting same error after restarting my glassfish 4 server.When I am trying to access my deployed application it was saying to mention full JDK.
login to Glassfish admin console.(http://localhost:4848).
Go to Configuration---->server-config--->JVM Settings
Set the java home with your correct jdk home (ex:C:\Program Files (x86)\Java\jdk1.8.0_121).
Restart the server.
It will work fine.
Next solution helped me
source: http://alvinalexander.com/blog/post/java/fixing-glassfish-jdk-path-problem-solved
Find your asenv.bat file. C:\Program Files\glassfish-4.0\glassfish\config\asenv.bat
Open it in text editor and find strings like "set AS_ = blahblah"
Add this string there "set AS_JAVA=C:\Program Files\Java\jdk1.7.0_60" (print your own JDK path here). If string "set AS_JAVA= blahblah" already exists then just fix the path.
Add JDK_HOME\lib\tools.jar file to the JDK configuration Classpath.
However, the problem in your case may be different as Glassfish JDK is not taken from IntelliJ IDEA settings, this question may help:
How do I specify the jdk for a glassfish domain?