IntelliJ : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)
The CurrCon Java Applet displays prices on this web page converted with today’s exchange rates into your local international currency, e.g. Euros, US dollars, Canadian dollars, British Pounds, Indian Rupees… CurrCon requires an up-to-date browser and Java version 1.8, preferably 1.8.0_131. If you can’t see the prices in your local currency, Troubleshoot. Use Firefox for best results.

JetBrains Intellij Idea  IntelliJ Idea
Introduction Tips
Pricing Sorting Run/Debug Configurations
Getting Started Hiding Source From Compilation
Configuring a Project and Modules With IntelliJ Backup
Hooking Up the JDK Files
Nice Stuff Annotations
Plug-Ins Yet To Learn
The Rearranger Links
Downsides

Introduction

JetBrains makes a high end IDE called IntelliJ Idea, usually called simply IntelliJ. The current version is 2016.2.4Last revised/verified: 2016-09-09.
The install includes both the 32 and 64-bit versions which are both installed into: "X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\bin\". If you have W7-64 and W8-64, use the 64-bit version idea64.exe otherwise use the 32-bit version idea.exe. IntelliJ comes with its own slightly older JDK (Java Development Kit), but you can configure it to use the latest JDK for compiling within Idea.

JetBrains gave me a copy of IntelliJ on 2006-02-20. I have been using it as my only IDE (Integrated Development Environment) ever since. I still use Visual SlickEdit for quick edits since Idea takes so long to start. IntelliJ is reknowned for its advanced editing and clever algorithms for factoring code. It is written in Java Swing itself. It comes with its own JRE (Java Runtime Environment), not necessarily the most recent, that it uses for driving the JRE. That JRE does not show up in the Java control panel or the Windows control panel. You can delete it by deleting the "X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\jre\" directory tree, then IntelliJ will try to use your default JRE. IntelliJ is also known for being faster than the competition. It has to be quicker and better since its competitors like Eclipse, NetBeans and Oracle are free. This is Chris Lamb’s favourite IDE. It runs under Windows, Max OS (Operating System) X and Linux. I like it better than Eclipse, but I have not used Eclipse in a long while and gave up on NetBeans long ago as too slow for my then elderly machine. It is hard to find someone with up-to-date experience on all three.

Pricing

It comes in five versions:
  1. $0.00 USD for the Stripped down Community version. Free to everyone. This is the Java developer’ Core. The Ultimate edition has support for J2EE, other languages etc.
  2. $0.00 USD for Ultimate Edition for Open Source developers.
  3. $99.00 USD for the Ultimate Edition for Academic use.
  4. $249.00 USD for the Ultimate Edition for Personal use.
  5. $599.00 USD for the Ultimate Edition for Commercial use.
All but the free versions come bundled with unlimited email support. The support is fast, courteous and generous, even when you don’t have official support. This is the advantage of using a commercial package.

Getting Started

To get started on your first project, you must manually navigate on hard disk to configure a JDK for it. Until then, it looks as if it is broken, showing an empty list of installed JDKs (Java Development Kits).

Like Eclipse and NetBeans, IntelliJ has its own vocabulary. Classes are grouped into packages. Packages are grouped into directories, reflecting the dot structure of the packages. Directories are grouped into modules. A module in a group of packages all compiled with a common source code target level. Modules are grouped into projects. All classes in a project must use a common code style. You recompile the project as a whole. Projects are usually more or less self-contained collections of code that share code. You might carve many distributables out of a single project. Usually I created 1 to 10 executables out of each package and bundle the package as a single distributable. Classes in the same project can share code simply by using an import statement. To use code outside the project, you must specially configure library jars etc. to import that code into the project.

It is easy to muddle up projects, directories, modules, packages. I discovered two tricks to help it out.

  1. Use a naming convention, e.g. end projects in p, and modules in m.
  2. If you don’t know if some node IntelliJ is showing you is a project or a module or a directory, refactor and threaten to rename it. IntelliJ will tell you what sort of beast you are about to rename.

IntelliJ puts a .idea subdirectory in any project directory and *.iml file in any module directory. If IntelliJ becomes confused about what is a project and what is a directory, you will have to put these back to rights.

Unfortunately, IntelliJ will ask you to create packages and modules without properly defining them first. You will likely have to start over from scratch once the meanings come clear. The key place to define these terms should be the screens displayed the first you are asked to name your project and module. Hint hint… However, you privileged. I have told you the secret.

To allow one project to use the class files of another, you import not the project, or the module, but the pack.age.class i.e. the name of the classes directory into your module settings.

You get at the module settings not with the settings menu item, but by right clicking on the module name root sources in the upper left of the left panel. This also where you select which compiler and compiler settings to use. There are many plausible ways to get at the settings, but only this one works. If you don’t remember this, it will be as if IntelliJ has forgotten what modules are.

I suggest experimenting with some small projects for a while to get the hang of things before you commit to your overall structure.

Everything is case-sensitive. It can be a real hassle if you accidentally create file in windows with the wrong case. Windows does not care about case.

Configuring a Project and Modules With IntelliJ

Oddly, Intellij uses a slightly different tree structure to hold its files if you make slightly different arbitrary choices when you install it. This can be baffling if you ever reinstall IntelliJ from scratch.

Configuring a project into modules is very simple, but there are so many options is it easy to go off the rails and spend an evening pulling out your hair. Here is how I do it. I create a new project (a very rare event) lets say called mp. I create eight modules within that project, that I call j1 j2 j3 j4 j5 j6 j7 and j8. I keep the code designed to run in Java version 1.1 or later in j1, the code to run in Java version 1.2 or later in j2 etc. I have dropped j1 … j6.

I configure each module with the appropriate source code level and click apply. I configure the output directory to use the module compile output path. Then compiled classes will then be put in directories with names like X:\intellij\mp\out\production\j1\com\mindprod\bio\. These output directories are intentionally not visible inside IntelliJ. when I want to explore them, I will have to use some sort of external file manager such as Windows Explorer.

I configure module j8 under module settings ⇒ dependency ⇒ add a j8 module dependency to j7 ⇒ mark it exported so that users of j8 will see j7 code as well. 

I now create my package structure under each module, i.e. com then mindprod then bio which creates a collapsing tree structure of packages. Then I can either create new classes or use Windows Explorer to drag Java source files into place in the tree. Clicking synchronise will make IntelliJ notice the new or updated files I placed in its source tree. I can also create new package directories with Explorer. The easiest way to handle this is to create your first packages and files with IntelliJ, look at the structure, then use Explorer to create more of the same structure.

IntelliJ stores each module configuration in an IML/XML file in the project tree. Yours should look something like this:

In the bad old days, when you installed an upgrade to IntelliJ, you had to redo all your settings, reinstall your plug-ins. Now it cleverly copies this sort of information from the previous install, even the vmoptions. However, when you uninstall the old version, after you get the new one working, do not tell the uninstall to also remove settings, otherwise you will delete them for the new version too.

Hooking Up the JDK

You must tell each project in IntelliJ where your JDK is and tell each module in each project where which target version to simulate.

  1. Click File.
  2. Click Settings.
  3. Click Build, Execution, Deployment.
  4. Click Compiler.
  5. Click Java Compiler (under Compiler)
  6. Click Javac.
  7. Click OK.
  8. In the project panel, click the name of your project. This is the tricky part. You must click the project, not the module to configure the module. You must also click the project in the left panel, not the one on the top bar. IF there is no left panel, open the project.
  9. Click Module Settings.
  10. Click Project.
  11. Select your Project SDK (Software Development Kit). If your JDK is not listed, click new and follow your nose. You can use a 32 or 64-bit JDK. You can use one different from what IntelliJ itself is using to drive the IDE.
  12. On the left, click modules.
  13. Click the name of one of your modules from the middle column.
  14. Select the JDK version level you wish to simulate for that module.
  15. Click Dependencies
  16. Select your Module SDK. If your JDK is not listed, click new and follow your nose.
  17. Configure anything else about he module while you are here.
  18. Repeat last five steps for each module.
  19. Repeat everything for each project.
  20. The key is you must tell IntelliJ twice for each module.

Nice Stuff

Plug-Ins

IntelliJ Plug-ins come with no installation instructions. It turns out that installing any plug-in is a snap. You don’t have to download or build anything. In IntelliJ, Click File ⇒ Settings ⇒ IDE Setting ⇒ Plug-ins. You can then view the plug-ins installed already and also what is available. Right click on whatever plug-in you want to install, then left click Install. (Selecting the plug-in and hitting OK does nothing, ditto reload.). You have to shut-down and restart IntelliJ before you can start using the plug-in.

In addition to the bundled plug-ins, you can find others on the web such as Sort text Ascending/Descending. To install, just download, Click File ⇒ Settings ⇒ Plugins ⇒ Install Plugin from disk.

The sort plug-in sorts case sensitively. You must have your columns perfectly aligned first. It does not trim. As a corollary, when you select, you must include all the lead spaces on the first line. As you would expect, your strings must fit on a single line. It would be nice to have a language-aware sort where you just clicked the variable and it found all the Strings to sort, dealing with the missing trailing comma, no matter how they are aligned and working even when strings span lines with concatenation.

Rearranger logo  The Rearranger

The original Rearranger plug-in is no longer supported. It is now built in. It is configured by clicking File, Settings, Editor, Java, Code Style, Arrangement. It fools you into thinking there is no Java under Code Style. You have to click Code Style to reveal it. You can export the settings as an XML (extensible Markup Language) file, modify them with a text editor and reimport them. The master copy including, all code style configuration, is stored in C:\Users\user\.IntelliJIdea2017.3\config\codestyles\xxx.xml

Downsides

Tips

Sorting

IntelliJ has some plug-ins to help with sorting:

Miscellaneous Configuring

Hiding Source From Compilation

If you have some Java source that does not compile, it will block you from running anything else. You sometimes want to disconnect it from your project until later when you can get it working. To hide it from compilation, click File ⇒ Settings ⇒ Compiler Exclusions ⇒ + and select the directories or files you want to leave out of the compilation.

Backup

Other than your source files make sure you back up the project description files, the *.ipr and *.iws files. Also back up your configurations in C:\Users\user\.IntelliJIdea2017.3\. These files can take hours to recreate from scratch.

Restoring the codestyle is a bit round about. You must create a new dummy configuration and save it, without the .xml extension. Then, shut down IntelliJ and overwrite that file with the one from backup. There is no menu command to restore. Make sure the internal codestyle name is also what you want.

Files

*.ipr is an XML file containing the project settings for a single project. It contains such things as code style preferences and spelling exceptions.

*.iws is an XML file containing the debugging settings for a single project. It contains such things as where the breakpoints are.

*.iml e.g. J:\intellij\mp\j8\j8.iml is an XML file containing the dependency settings for a single project/module. It contains the list of source code and class jars that this project code depends on.

There are three places to look where IntelliJ might hide its information:

  1. "X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\". This is the program directory.
  2. C:\Users\user\.IntelliJIdea2017.3\. This is the data directory. It contains all manner of configuration information about IntelliJ, including the codestyles description, plug-in jars relevant to all projects.
  3. J:\intellij\mp\.idea\. This is your project directory tree where you also keep your Java source code. It will have a name of your choosing with additional directories and files inserted there by Intellij.

In particular

IntelliJ has an export option to export a variety of configuration information into a jar for backup.

Annotations

To use annotations, e.g. @Nullable or @NotNull inside IntelliJ, you must add "X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\redist\annotations.jar" as a library of annotations to the module. You might want to turn on external annotations in settings ⇒ code style ⇒ code generation to store annotations outside the source code. I could not get annotations internal or external to work.

Yet To Learn

I need to find way to trigger the light bulb suggestions for improvement. If I don’t look at them right away, they disappear.

How to keep the Alt-F7 Usages Window from disappearing before I have finished with it. You can get in back again with the tab. It might be nice to have them in another window always visible, especially if you have a big screen.

IntelliJ has a CSS (Cascading Style Sheets) and HTML (Hypertext Markup Language) editor as well, complete with refactorings. I have not yet used it. Perhaps it will do the various cleanups I thought I would have to write custom code to do.

IntelliJ integrates with many version control programs.

I can think of many useful plugins that would be easy to write. However, I don’t understand the process needed to integrate them into the JRE.


This page is posted
on the web at:

http://mindprod.com/jgloss/intellij.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\intellij.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[54.198.146.13]
You are visitor number