How to remove the extra KotlinJavaRuntime at External Libraries?
My External Libraries has multiple KotlinJavaRuntime.
MacOS Big Sur ver.11.4
IntelliJ IDEA ver.2021.1.2 (Community Edition)
enter image description here
Select this library from the External Libraries node and use Main Menu | View | Jump to Source action (F4 default shortcut) to open this library in the Project Structure dialog.
Then check if this library is used in any of the project's modules by using Main Menu | Edit | Find Usages | Find Usages action (Alt+F7 default shortcut):
If the library is not used in any of the modules - just remove it from the project structure.
Related
Every time I create a new JavaFX project in IntelliJ it loads a simple HelloWorld project in it. How can I make it empty instead (without the need to delete those .java files every time)? Also how can I choose to create the project without a building system (as you can see in the picture, I'm always forced to create the project with Maven or Gradle)
When creating the new project, choose "Java" instead of "JavaFX".
A JavaFX application is just a Java application, so if you don't want the additional things which IntelliJ is doing when you choose to create a JavaFX project (e.g. supplying example code and associating with a build system like Maven or Gradle), you can just choose a basic Java application project from the wizard and it won't do those other things.
See the section in openjfx.io documentation titled "JavaFX and IntelliJ IDEA" for other steps you need to take:
Set the project JDK
File -> Project Structure -> Project
Create a JavaFX library in Idea
File -> Project Structure -> Libraries
Point to the lib folder of the JavaFX SDK.
Add VM options for the module path
Run -> Edit Configurations...
--module-path /path/to/javafx-sdk-15.0.1/lib --add-modules javafx.controls,javafx.fxml
For windows use quotes around the path and \ rather than /.
Run the project
Run -> Run...
You might also need to take the actions identified in the accepted answer to:
How to convert a normal java project in intellij into a JavaFx project
But that answer was written a while back and setting the resource copy configuration to include JavaFX fxml and css files might not be needed anymore.
Now, you might think that is annoying amount of things to do, and I might agree with you.
How can I configure IntelliJ IDEA to have Annotation processors enabled by default?
Currently, I have to enable it manually for every imported project.
Current IDE version:
File | New Project Settings | Settings for New Projects..., navigate to the compiler settings, annotation processing and enable this option before importing the project.
Previous versions:
File | Other Settings | Default Settings, navigate to the compiler settings, annotation processing and enable this option before importing the project.
I am working on a multi level maven based project. One of the modules had dependencies issues and I had excluded it: now I wish to reenable/re-include that module.
The IJ documentation says to go to
File | Settings | Compiler | Excludes
However that option reports "No excludes". Apparently the above documentation does apply to Maven built projects
Note the above is also the suggested way for another question with similar title How do I re-include a class into the build path in Intellij IDEA? . So please do not mark this question as a "duplicate".
I also tried :
File | Project Structure | Modules.
But there was no mention of excluded paths there either.
When I'm working on an Android app, I can control+click on a function call in editor to navigate to the function source. This works well for classes in the project and classes in Android SDK. However, if I control click on a function call that is from an Android Support Library (say: android-support-v13.jar), I'm taken to a file that has the function signature but the contents say "compiled code".
I tried adding the path to the support library's source to Project Structure->Sources but looks like that didn't make any difference.
How do I set this up right.
Navigate to Project Structure | Libraries
If you haven't already, create a library and add the android-support-v13.jar
In the same library, click "Attach Files or Directories..." and select the Android Support Library's src directory (<android-sdk>\extras\android\support\v13\src)
Add this library as a project dependency
Your library should look something like this:
I downloaded the JavaFx source code from http://hg.openjdk.java.net/openjfx/2.2/master/rt/summary.
The name of the folder in the zip file is re-e71070b0e0c0.
I unzipped this and added the folder under Project Structure - Global Libraries in Idea, however it doesn't work. When I try to open a class it just shows field names and /* compiled code */. I couldn't find anything in the manual.
Much of the information in this answer is now outdated.
More up-to-date information on using JavaFX with Java 11+ in IntelliJ Idea, is available at:
openjfx.io in the section titled: "JavaFX and IntelliJ".
Though, the above-linked article is more focused on using JavaFX in IntelliJ rather than viewing JavaFX library source code in IntelliJ.
These instructions are only necessary for the JavaFX 2.x branch and will be obsoleted once JDK 8 is released.
After you have downloaded the source zip and extracted it, open Idea and follow these instructions:
Modify the source structure for your 1.7 SDK:
File | Project Structure | SDKs | Sourcepath
For each sub-project in the extracted zip, type Alt+Insert and add the respective source directory. For example rt-e71070b0e0c0\javafx-ui-charts\src, rt-e71070b0e0c0\javafx-ui-common\src, etc. Not all JavaFX 2.x source code is currently open sourced, so this will only add the open sourced portions.
Set the documentation lookup path:
File | Project Structure | SDKs | Documentation Paths
Specify a url Alt+S for the documentation: http://docs.oracle.com/javafx/2/api/
In your JavaFX application source, place your cursor over a JavaFX class usage, for instance LineChart:
Press Ctrl+B to open the source code file LineChart.java from your downloaded zip.
Press Shift+F1 to open documentation on the LineChart in a browser.
Press Ctrl+Q to get quick access to documentation from in the IDE.
Update Oct 16 2013
JDK 8 now includes JavaFX source files.
To tell Idea where JavaFX sources are:
Modify the source structure for your 1.8 SDK:
File | Project Structure | SDKs | Sourcepath
Press Alt+S to add the file javafx-src.zip, which is located in the root directory of the JDK 8 distribution.
Set the documentation lookup path:
File | Project Structure | SDKs | Documentation Paths
Specify a url Alt+S for the documentation: http://download.java.net/jdk8/jfxdocs.
The JDK 8 JavaFX documentation url will likely change when JDK 8 reaches General Availability release stage.
Step 3 above provides keyboard shortcuts to quickly access the JavaFX sources and documentation from your project.
(Since this is one of the Google hits for "javafx source code", I'll dump this anwer here too):
Quoting from this answer: For Java 8, the source of the public parts of JavaFX are actually laying right along in the JDK installation as a sibling of src.zip: javafx-src.zip - on the root of your normal JDK Java 8 installation.
Eclipse doesn't by default link them up when you add the JRE (or it finds it itself) - obviously a bug - so you'll have to do that yourself, by hitting Preferences -> Installed JREs. Find your JDK 8, hit Edit button. On the list JRE system libraries, expand the jfxrt.jar node, and link in the javafx-src.zip file.
I've faced this problem on Ubuntu 16.04 with JavaFX 8 (open-jfx package). The fix was to install the missing source package:
sudo apt install openjfx-source
IntellJ started showing JavaFX source code the second after the command finished executing.