Getting set up with intelliJ IDEA - intellij-idea

Really basic question here but this has always stopped me from using any JetBrains product, but here I am trying once again. I also have the same issues with CLion but that will be for another time and hopefully I can figure it out based on some feedback from this post.
I need to set up my environment in IntelliJ. Nothing special. No build tools. Currently I just run my school projects using
javac Main.java
java Main
This has gotten me so far but I really want to use IntelliJ tools to their full capacity.
I want to be able to set break points and step in and out of my code in their debugger and all the other nice tools that come with running my code through IntelliJ
Every get started tutorial that I have watched on YouTube or from JetBrains themselves already has a basic build configuration set up to run your basic "Hello World" application and that is what I think I need. Just compile my java files into classes and run/debug them.
This is what the run configuration icon in the IDE should look like
And this is what mine currently looks like
I have set many different JDKs to go along with my projects but none of them seem to get the tools I need set up in the IDE. I have even let IntelliJ download one for me and set it up itself to see if maybe I downloaded and installed it wrong and IntelliJ maybe wasn't recognizing it.
This picture below is showing the project structure for an application that I let IntelliJ download a JDK for and set it up itself
So if someone could help me that would be fantastic. Links to videos, blogs are welcome even though I know that isn't the convention on this forum but I think that would be sufficient for my situation. Thanks in advance!
---Update---
I have found that if I create a project in IntelliJ that I get all the default configurations that I need. The problem is when I need to get a project from VCS that I am not getting any of the configurations that I need to run/debug my program in IntelliJ.

The easiest solution here would be to click the green play button next to your main method, on the left where line numbers are displayed.
Intellij will configure a default java run configuration for you. It will be displayed in the menu for later use, like in the screenshot you posted, after your first run.
You can also create one using the to menu: Run > Edit run configuration to add some more options like arguments, environment variables (that only apply for the run config), etc.
A good starting point would be the Intellij help page on that topic. This help pages are always a good start and you find comprehensible instructions there on every topic.
Another good resource is the Intellij by JetBrains YouTube channel. This video about debugging shows both ways I described above. They have lots of quick tutorials about lot of features, like code generation or build tools. Check out the channel's playlists for specific topics.
Update
The problem with the already created project is that the default/ folder is not marked as source folder. You can do that by File > 'Project Structure...' and set the default/ folder as Sources:
The cause for intellij not recognizing this is because you didn't use a folder structure like the one of maven.
For source code:
src/main/java
src/main/resources
and for tests:
src/test/java
src/test/resources
If you set it up that way IntelliJ everything works as expected. I created a pull request to your repo. If you check out the branch, IntelliJ will setup everything correctly automatically.

Related

Debugging an app with computed environment variables in IntelliJ IDEA

Consider an app which, in 12-factor style, receives its config in the form of a JSON document provided as an environment variable. The config contains secrets, so it is never stored on disk; instead, it is computed on the fly before starting the app, using something like sops or nunjucks.
I am trying to debug such an app in IntelliJ. Is there any way to run some arbitrary script before launch and provide its output to the app as an environment variable?
I will accept answers for any run config type, but an approach that works with "npm" or "Application" would be most helpful for me.
EnvFile IntelliJ IDEA plug-in added this option some time ago.
I did a quick test and don't see this option available, at least on Windows.
EDIT: found it was only merged in the forked version and not available in the official plug-in. You will have to merge it manually and build the plug-in from sources.
IntelliJ IDEA doesn't have a built-in feature for that, feel free to vote for the corresponding request.

How I can use the JavaFX framework?

firstly, I want let you know how useful this community is for me, I was stuck on an error
`Error: JavaFX runtime components are missing, and are required to run this application`
and thanks to this answer I actually solved: link
However I've a couple of questions. I noticed that IntelliJ doesn't change the configurations (Like set the VM option and pick the right library for the javaFX project), so each time I've to create a new JavaFX11 or 12 project I've to being throw all the manually settings again.
There's a way for set a "default behaviour" for the IDE ? It's really cumbersome.
The second question is, how I can use all the beautiful framework that the developer community offer for JavaFX? I've seen on openjFX a couple of interesting framework like TilesFX or CalendarFX but there's no information on how implement them on my IDE neither on GitHub nor here.
I have seen that most of them uses Gradle files, but honestly I don't have the faintest idea of what this kind of file does and how implement it on IntelliJ. Thank's to everybody.
Run the project with a more recent JDK like JDK11, for example.
If it does'nt work, you probably forgot to change the JDK of your builder in IntelliJ!
Open the settings and follow the path as bellow:
FOR MAVEN
FOR GRADLE

Intellij 2018.2 stops working and exits on MacOs. What might be a problem?

As an daily IntelliJ user you usually concentrate on the projects you are working on and IntelliJ is just a tool. You are not willing to dig into tool's problem itself. But this is what is forced on you by default after IntelliJ installation on MacOS and opening relatively big project(most of the projects nowadays are huge and have thousands of files and use numbers of IntelliJ 3rd party plugins).
Here is a minimal list of actions. IntelliJ must have set MORE RAM to be used by default.
Read: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files .
From IntelliJ open Help / Show log in Finder and open idea.log file with Console.app; In Console.app press "Reload" and "Now" buttons to track "live" what IntelliJ is doing.
If in logs of IntelliJ you find that some of the plugins exit with fatal error, you just uninstall those plugins. For me the one that failed to the moment of this answer was "BashSupport" as example.
Start Terminal.app ; Run command: open -a TextEdit /Applications/IntelliJ\ IDEA.app/Contents/bin/idea.vmoptions ; Change options in idea.vmoptions file to:
-Xms1024m
-Xmx2048m ; Read https://www.jetbrains.com/help/idea/tuning-the-ide.html to see how you can tune IntelliJ for your project. This step is handy when your IntelliJ app doesn't start at all and you want to change properties in a global way.
From IntelliJ open Help / Edit Custom Properties.... Here you can set same properties that will override global and will work only for current OS user.
Also there is also a possibility of underlying OS to do it voodoo magic so the IntelliJ won't work as it should like here - https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000398280-IDEA-Ultimate-2018-2-Unable-to-save-settings-Unable-to-create-file-Windows-10
Make sure your project build output for *.class files is set. Read: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000000584-Build-does-nothing . In my case when IntelliJ started project build it terminated without warnings shortly after.
Finally in my case none of 6 steps above solved the issue so I found this read: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000532044-IntelliJ-cannot-build-projects . Basically try reinstall IntelliJ from original distribution again.
I know that you must read https://www.jetbrains.com/help/idea every time you install a new version of IntelliJ, but why not to add some consistency into configuration process of the main java process that runs IntelliJ itself? You can ask how much ram to use during installation of IntelliJ and explain why it is so. Then Help digging won't be necessary in the first place for devs who fed up with changing those default settings that will be always more than 700MB. I think for most devs out there it is at least 10x of that. I bet what makes most devs mad about this is not the fact that you need to do some options changing, but where those options are depending on OS plus the fact that you simply forget why IntelliJ app just exits while you are doing a debugging of your own app. I bet this problem makes us mad since first java based IDEs appeared. User-friendly is the key here and explicit reminders within the app itself would help.

Start with MonetDB development

I want to integrate features into MonetDB, more specifically into the dictionary part of it. I found some information here, but this is not really elaborate.
The concrete feature I want to integrate is secondary in my question here. My biggest hurdle at the moment is: how do I start to develop MonetDB?
I was able to download the source and build it as described here. But where to go from there?
My preferred way would be: get MonetDB in some form of an IDE, set various breakpoints, send a SQL query and explore the code from there.
Is this possible? What development environment do you use? Is gdb debugging the only possibility? How do you debug?
Meanwhile, I figured it out myself. Maybe, somebody else will face this problem, wherefore I answer my own question. I finally ended up with Eclipse and describe a possible way to start MonetDB development/debugging:
Clone MonetDB repository from the official repository, e.g., from Github
Download the C++ version of a current Eclipse release
In Eclipse click on File > New > C/C++ > Makefile Project with Existing Code > Next. Insert the cloned repository dictionary as Existing Code Location and select the GNU Autotools Toolchain
Now you should be able to build MonetDB inside of Eclipse
After a successful build, you can choose Binaries from the Project Explorer. There you can right click the different binaries and use to run as or debug as
This finishes the setup of MonetDB inside Eclipse. Now, it depends on what you want to debug. If you want to change something at the server, you might want to debug monetdbd. My tips to do this are:
Start debugging of monetdbd per right click as explained before
Close the debug session and adjust the debug configuration
On the Arguments tab, insert the arguments: start -n <path to your dbfarm>. This will keep the database daemon from going into the background
On the Debugger tab, select Automatically debug forked process and optionally Non-stop mode
A new debug session will now automatically stop at the main of monetdbd and will also show the threads of the forked mserver5 process

New Elixir project in Intellij

I've recently started using Elixir and I'd like to keep my code files in quite decent order. So I installed Elixir plugin for Intellij: https://github.com/KronicDeth/intellij-elixir, but stuck with trying to start an Elixir project. Could you give me some tips how to make new Elixir project?
I'm the maintainer of intellij-elixir. Please file support question as Issues on github: https://github.com/KronicDeth/intellij-elixir/issues. In fact, someone already asked a similar question (https://github.com/KronicDeth/intellij-elixir/issues/77). In summary, right now you can't create "Elixir Project". There isn't yet an "Elixir Project" feature/action although you're welcome to open an issue to make that a feature request. (It's nice if you open it instead of me opening it for you as you'll be subscribed to updates then.) With the feature set as is, you can create any type of project you like because all that matters is that the file extension is .ex for the Syntax Highlighting, Grammar parsing, Inspections and Quick Fixes to work. I just create the default Java project when testing intellij-elixir in Intellij or an empty directory or project layout created by mix new in Rubymine. Since two people at least have brought this up I'll add something to README after I'm finished with https://github.com/KronicDeth/intellij-elixir/issues/59.