I've got two dev workstations, one running Windows, the other running Linux. I work on a Java project using Intellij on both. Both platforms have the Oracle JDK 7 installed in the default locations.
For some annoying reason, every time I switch platforms, I need to update the project configuration to specify what JDK it should be using. In the project's "Project SDK" setting, there's a JDK selection which includes two entries - 1 for a JDK in c:\Program Files\Java\jdk_1.7 and the other for a JDK in /usr/lib/jvm/java-7-jdk/. If I open the project on Linux, I have to specifically set the Project JDK to be the second. If I save the project, close, commit, and then checkout and open on Windows, it complains it can't find the JDK, and I have to manually set it to the Windows version.
Why can't Intellij figure this out automatically? I appreciate that testing against multiple installed JDKs is a useful feature, but is there a way to tell a project to 'just use the default JDK'?
You need to have your JDK configurations to have the same name, lile 1.6 or 1.7. Project file references JDK by its name only so it will work out of the box in all IDEA installations on different operation systems, the only requirement is that there is JSDK defined under exactly the same name.
Related
Every time I create a new project in InteliJ it creates only a iml file, and I cannot see my file and libraries. But after I close the project and make the same project by override, it works.
I suspect it's something from the settings, but I don't know where.
I use IntelliJ IDEA 2021.3 (Community Edition)
Build #IC-213.5744.223, built on November 27, 2021
Runtime version: 11.0.13+7-b1751.19 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 7 6.1
PS: I am looking for a more permanent solution, as it gets fustrating..
Well, it seems that it has a small bug.
When I make a new project, I have 2 ways of creating in:
by choosing a name in the Project name field, and then obtional choose the path manually if required. This works very well.
by skip the first field and live untitled as it is, and choose the path in the Project location field, creating a new folder, and then when you came back the Project name field is with the name of the folder, but when I click finish, I can not see modules, compiler settings and SDK selected. (see the picture from the question)
I have installed JRebel plugin for Intellij Idea and my project is running with Jetty gradle plugin.
I run my project with "Run with JRebel", project perfectly runs, but hot swap which i expected is not working.
Does anybody have an understandable and detailed instruction how to set up Jrebel for work with jetty, gradle and intellij idea?
1) You need to add JRebel Agent as a vm argument into Jetty.
Depending on your environment:
Windows 64-bit JDK jrebel64.dll
Windows 32-bit JDK jrebel32.dll
Mac OS X 64-bit JDK libjrebel64.dylib
Mac OS X 32-bit JDK libjrebel32.dylib
Linux 64-bit JDK libjrebel64.so
Linux 32-bit JDK libjrebel32.so
You need to add -agenthpath argument in gradle.properties file:
org.gradle.jvmargs=-agentpath:[c:\path\to\]lib\jrebel64.dll
2) You need to generate rebel.xml files for your projects in JRebel IDE plugin
Right-click on the project node in the Project View and select JRebel > rebel.xml. Alternatively, you can check projet in JRebel Modules window
3) You need to deploy(run) your projects into the Jetty with rebel.xml configuration files and when you make a code change in a .java file you need to generate new .class file. IntelliJ IDEA does not compile classes on save by default. Press Ctrl+Shift+F9 to compile the current file, module or package (you can also find this command via Build > Make Project).
When downloading IntelliJ IDEA, there are two options for Linux:
I assume the Linux (.tar.gz) version comes with a JDK and the Linux, without JDK (.tar.gz) version does not. However, when reading the documentation I see:
IntelliJ IDEA does not include an SDK. So, before you start writing your code, you have to download and install at least one SDK and define it in IntelliJ IDEA.
So what exactly is the difference between the two versions? And if one comes with a JDK, which JDK does it come with?
This is the JDK IntelliJ IDEA itself runs on. To quote a related support document:
Starting from IntelliJ IDEA 16 and the most recent versions of the lightweight IDEs, we are bundling custom JRE with Linux distributions, just like we've been doing for Mac. Our custom JRE is based on OpenJDK and includes the most up to date fixes to provide better user experience on Linux (like font rendering improvements and HiDPI support).
For your own projects you will probably want to use an official and supported Oracle JDK.
I have two Java JDKs installed on my workstation, with jdk1.6.0_41 in my path, and jdk1.7.0_21 available as well, but not in the path.
How can I configure IntelliJ IDEA 13 to use a particular JVM? To be clear, I want to set the JVM used to run IntelliJ itself, not the SDK used for running my code. I am running Windows 7 Enterprise Edition and launch IntelliJ 13.0.2 by running idea64.exe
I have set JAVA_HOME to point to jdk1.7.0_21 but according to the About box it is using jdk1.6.0_41.
This FAQ on the JetBrains web site describes how to do this for Mac, but not for Windows.
This answer suggests using the IDEA_JVM environment variable for Ubuntu 12, but I have tried that and it isn't working.
I suspect you have another setting that is overriding your JAVA_HOME
From Jetbrains docs:
idea64.exe uses this JDK search sequence:
IDEA_JDK_64 environment variable
..\jre64 directory
system Registry
JDK_HOME environment variable
JAVA_HOME environment variable
With newer versions the environment variables are ignored. Instead there is a new action "Choose Boot Java Runtime". The easiest way to get to it is via "Find Action" Ctrl+Shift+A.
You can also edit the setting via the .jdk file in your user configuration directory, e.g. %APPDATA%\JetBrains\IntelliJIdea2021.3\idea64.exe.jdk. This is a plain text file containing only the path to the JDK.
It is not recommended to do this, and you should use the JDK that is bundled with IDEA.
CTRL+ALT+SHIFT+S to go to Project Structure
Under Platform Settings, go to SDKs.
Use the + green icon to add a new SDK and set it to that one.
How can I JSDK of Intellij 9.0 on MacOSX? I want to set it to JDK 1.5 on MacOSX.
I have tried reintall Intellij, but it somehow remember the JSDK of my previous installation.
Can you please tell me how can I reset it?
Thank you.
Not sure if you mean Java version IntelliJ runs under, or Java version IntelliJ uses for projects.
If it's the first:
On OS X applications are usually directories. This is true for IntelliJ.
Go into the IntelliJ 9.0.app folder
Go into Contents folder
edit Info.plist (you will need to have installed Apple's Developer tools)
There is a Java subsection that has the setting you need to change.
If it's the second, go to Project Structure -> JDKs and create whatever ones you want.
Depending on your OS X version, you may have no JDK 1.5 installed at all (Snow Leopard 10.6.x comes with no JDK 1.5). In this case IDEA will run under the first JDK it finds, even if it's 1.6 while Info.plist specifies 1.5. If you have both JDK versions installed, Info.plist should work fine, see the IDEA FAQ.
If you want to install JDK 1.5 on Snow Leopard, see another IDEA FAQ article.