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 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:
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.
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.
Use a naming convention, e.g. end projects in p, and modules in m.
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.
Click File.
Click Settings.
Click Build, Execution, Deployment.
Click Compiler.
Click Java Compiler (under Compiler)
Click Javac.
Click OK.
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.
Click Module Settings.
Click Project.
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.
On the left, click modules.
Click the name of one of your modules from the middle column.
Select the JDK
version level you wish to simulate for that module.
Click Dependencies
Select your Module SDK. If your JDK
is not listed, click new and follow your nose.
Configure anything else about he module while you are here.
Repeat last five steps for each module.
Repeat everything for each project.
The key is you must tell IntelliJ twice for each module.
Nice Stuff
It starts in 13 seconds (from SSD (Solid State Disk)
drive). I would like this faster, but it pretty good compared with what I put up with in past. It tend to leave
it running all the time.
Like Eclipse, it instantly warns you of syntax errors as you type. They disappear as soon as you fix the
problem. You don’t need to invoke the compiler to check out your corrections.
The error messages are more intelligible than Eclipse’s.
It warns you when override a method in the superclass with a tiny red arrow in the margin, with a tooltip
to explain what it means.
It is quite easy to find things. Menus and dialogs go more or less directly to what you want. Even on my
first time out I did not get lost wandering around a rabbit warren of nested dialogs. It is quick and easy to
find thing in help. For example, you click the wrench icon and then laid out before are all icons for all the
different things you could possibly configure. You go right to what you want, rather than playing rabbit in the
warren of nested menus trying to find it.
It is very similar to Eclipse. I had very little problem adjusting to the differences.
If IntelliJ were a person, you might describe it is polite, considerate or thoughtful. It is sort of like
the lady in a hotel who puts a little chocolate on your pillow. There are considerate little touches, like
telling you in the default code templates where to look to modify them, rather than making you go digging. Like
the gracious Mrs. Prothero in Dylan Thomas’s A child’s Christmas in Wales, IntelliJ
offers you something interesting to read while it is compiling.
Back in the 70s IBM (International Business Machines)
used to give away folding cardboard cheatsheets. The green card, the blue card or the pink card neatly
summarized all the information you often had to look up in manuals. IntelliJ carries on this fine tradition
offering a PDF (Portable Document Format)
file that when you print it, turns into a folding cheat sheet that shows all the keyboard short cuts. It is one
sided. Perhaps there is a backside for it.
If you want to change a method signature, add a parm, reorder parm, drop a parm it will do it all
flawlessly in a second in every class.
It will write getters, setters and constructors for you.
You can highlight a piece of code that should be a separate method. If figures out the parms needed and
replaces inline code to use your new method.
You can globally rename variables, methods and classes and it renames the string in just that context, with
intelligent suggestions on where to rename the string in other contexts such as comments. It fixes up file
names and run time parameters to match.
If you type a variable name then a. then pause, it will display a list of legal method names to choose
from.
Type the template name soutv then Ctrl-J. You select a
local variable, then it generates something like System.out.println( isbn13
= + isbn13 );
It semi-automatically fills in the imports for you, sorts them, prunes out the ones not needed and enforces
your own rules on when to use individual imports and when to use *.
There are no limits on how many executables you can configure. You have even have several command-line
variants for a single class.
You can find things quickly, e.g. Ctrl-N + the start of the name of any
class in the universe and bang you are there. Ctrl-B and you are at the
definition of something. Shift-F6 and you can see all the uses of something.
Alt-down takes you to the start of the next method. The command I miss is
take-me-back-to-where-I-just-was. It must be in there somewhere. I am always learning new commands that I did
not know I needed desperately.
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.
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
You have to renew your licence each year. Things always seem to screw up so that I go without Intellij for
a few days each year. Installing the new licence is unbelievably complicated. It is aimed and providing
licences for teams. The trick is to email yourself an invitation to download a licence key. Invalidate and
repeat as necessary. Then click the licence download link, and export the key for offline use to a text file.
Then paste that into IntelliJ. Make sure your launch icon references idea64.exe not
the 32-bit idea.exe. The 32-bit version requires a 32-bit JDK.
IntelliJ is less jittery than Eclipse about temporary errors in code, such as something not defined yet, or
is unused — it just changes colour. However, IntelliJ annoys you by asking if you want to import anything
it does not recognise. In Eclipse, syntax errors generate a giant slew of messages, making it hard to deal with
anything else. On the other hand if you type out. when out.
has not yet been defined, it will help you by converting out. to something else containing the letters out that
has been defined.
It has thousands of specialised features not relevant to developing ordinary Java code. These suck up all
the support oxygen often leaving more mundane problems unattended to.
It does not summarise your errors at the bottom of the screen the way Eclipse’s problems panel does. At least it doesn’t by default. You have to go looking for the little
syntax error markings. I find them easy to overlook and thus don’t find out about my errors until a full
compile. F2/Shift-F2 help you find them within a file fairly easily.
Though it sometimes underlines errors in Javadoc, it does not pester you about fixing them the way Eclipse
does. I find it easy to overlook the errors. They don’t count as compile errors or warnings. I
don’t get them cleaned up until an Inspector pass.
If there are files in the library for a project that don’t belong and you delete them, it literally
deletes the files. It does not simply remove them from the project.
If you want to access files you compiled outside IntelliJ, it is best to bundle them up into jars and
include the jars individually rather than try to provide a classpath. If you use a classpath, you will either
end up including far more than you intended, or it will claim not be to able to see the directories you did
import.
When you are working in Eclipse you are always aware instantly of the global effect of your every
keystroke. In IntelliJ, you focus on one class at a time. You can only see one project at a time and when you
swap projects IntelliJ frantically rescans the source. There is no equivalent of the workspace, a collection of
classes from various projects that you are working on right now in concert, other than a set of windows you
have open.
When you run the code inspector (lint), it often display the results from some previous run. It saves old
runs, something that is just confusing.
How to write plug-ins for IntelliJ is not well documented.
Sometimes the message from a successful compilation gets lost. All works, but it does not acknowledge.
If you reconfigure which JDK
to use for a project, IntelliJ hubs away for what seems an eternity. It is reindexing all the class files in
all the jars and also all the source code in the JDK. Just let it
churn. If it doesn’t, select invalidate caches to force it to reindex the
JDK.
You have very detailed ability to define your code formatting style. With a single click you can pull an
entire project into conformance. However, when you save a configuration, it does not show up in
C:\Users\user\.IntelliJIdea2017.3\config\codestyles\ until you exit
IntelliJ. It requires you to have changed something in the configuration before it will save it. Strange as it
sounds, you must make some tiny change to the configuration both before and after the save-as to have it
recorded on disk. Further, it fails to save unless you run IntelliJ as an administrator. It is not enough to
just log-on as administrator. You must configure the icon to launch IntelliJ with run as
administrator. To restore, you must put the xml config file in
C:\Users\user\.IntelliJIdea2017.3\config\codestyles\. You can’t
load it from some other directory. Just to confuse you, the name of the configuration is not necessarily the
same as the name of the file. It is embedded in the XML
in <code_scheme name=xxx>. Make sure the external and
internal names match. The current scheme is recorded in
C:\users\user\.IntelliJIdea2017.3\config\options\other.xml. The behaviour is mindbogglingly hare-brained. Why can’t they just let you
export/import a scheme or insert one in the codestyles directory and have it included. There is a way to
export/import settings, but not just the code scheme.
If you try to debug a class not in the current project, it gives no error message, just terminates
immediately.
I have not found a way to get it to automatically insert importstaticjava.lang.System.out. It will happily
remove it if it is not needed, however.
Sometimes syntax errors make it think most of your imports are not needed and it tosses them.
Tips
Used pinned mode to keep your console or debug windows from disappearing. You can
also restore them with Alt-5.
Any time you upgrade your JDK, in IntelliJ, you must open modules for each of your modules and configure the new JDKthree times per module. Further you must update the JDK
in each module in the project structure section. Ideally you could set these all to auto, (the default) and
they would automatically be set to the JAVA_HOME environment variable.
Put put your resources for use in debugging in the src tree e.g.
J:\intellij\mp\j8\src\com\mindprod\vercheck\sound\ Previously, you put them in the out tree.
If, when you install IntelliJ, you get an error message, failed to create
JVM (Java Virtual Machine): error code -1 The problem is likely you don’t have a 32-bit
JDK
installed. It is trying to run the 32-bit version of idea.exe, even if you have a
64-bit OS
and a 64-bit JDK. Just create a desktop shortcut to
invoke "X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\bin\idea64.exe"
If you want to turn on -Xlint:unchecked go into project
⇒ settings ⇒ Java compiler and add it to additional command line
options not additional build process vm options.
To modify the project setting, click settings half way down the file menu. To modify the module settings, right click on the module
name, then click open module settings at the bottom.
If IntelliJ complains it cannot find your library or annotations packages, go into module settings, and
edit the JDK
path, then set it back the way it was. This will cause it to have a fresh look at the ext directory.
If you want Intellij to insert the static import for a set of enum constants, Place your cursor on any of the enum constant instances. Open the Intentions Action
Menu (Alt+Enter) and select Add on demand static import
for…. If you just want to import one constant, such as FIRST, place
your cursor on FIRST Open the Intentions Action Menu (Alt+Enter) and select Add static import for FIRST Note: if you do not see
those options in the Intentions Action Menu, turn them on in Settings ⇒ [
IDE Settings] ⇒
Intentions ⇒ Imports.)
To have IntelliJ automatically insert import staticjava.lang.System.out you are out of luck because IntelliJ removed the feature. However, you can
click File, Settings, General ,
Editor, Auto Import
and turn on static import suggestions.
To pause or restart the console output, click the
icon on the left. If it is dull grey, you are already paused. If it is bright blue you are not paused.
When you want to run or debug programs, don’t scan up and down the list looking for it. Just type a
word that occurs somewhere in its title.
One by one, the IntelliJ features stopped working. Programs would not run. Ctrl-B could not find definitions. The inspector gave bizarre advice. IntelliJ would ask to
me import classes that were already imported. Presumably there was some corruption in my configuration files,
but I could not find or correct the problem despite many attempts. I was about to give up on IntelliJ and try
NetBeans or Eclipse. I fixed the problem by uninstalling IntelliJ, erasing all IntelliJ files on all drives
including those interspersed with my java source code and reinstalled and recreating my configuration by hand
rather than by restoring my old config. This drastic measure was successful. Another time the problem was a
corrupted "X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\bin\idea.exe.vmoptions" file. I
don’t know what causes this corruption. IntelliJ support people talked me through fixing that
problem.
If you change your plug-ins, you must restart IntelliJ to make those changes take effect. If that fails,
invalidate the caches.
Let’s say I know I need an addAdjustmentListener, but I am not sure where
to hook it in. I don’t know what classes support addAdjustmentListener. If I
type Ctrl-Alt-Shift-N addAdjustmentListener, IntelliJ will tell me the classes and
interfaces that support addAdjustmentListener.
Always use the change signature feature when you add, remove, reorder parms on a method. It will not forget
to fix some obscure invoking of the method you forgot about.
When you click settings, scroll down. Most of the options, including the one to install plugins, are not
immediately visible.
Class file and Resources
Intellij changes its mind every once in while about where to put the compiled class files and where to
expect to find the resources. It used three different places in recent memory.
Delete all class files in the IntelliJ project tree with del /s *.class.
Rebuild the entire project.
Look where IntelliJ is putting the class files today.
As of 2015-10-31 it puts the class files in:
J:\intellij\mp\out\production\j8\com\mindprod\package\J:\intellij\mp\out\production\J7\com\mindprod\package\
As of 2015-10-31 it looks for resource files in:
J:\intellij\mp\j8\src\com\mindprod\package\
Sorting Run/Debug Configurations
To sort your debug/run configurations, you can
do it manually tediously with the arrow keys, or more rapidly with drag and drop, or using this kludge.
First determine which is the real workspace.xml by making some trivial change
to your Run/Debug configurations and exiting IntelliJ to flush it. I have have six of them! It will be somewhere in with your
project and source files with a recent timestamp. Mine lives in
J:\intellij\mp\.idea\workspace.xml There are two
others J:\intellij\.idea\workspace.xml and
J:\intellij\mp\j8\.idea\workspace.xml.
Make a copy and second backup copy.
Examine the copy with a text editor.
Ignore the <config entries for the various configuration. Their order
does not matter.
Look for an entry like this <list size="42">. Just below it
will be entries like this:
What controls the ordering is the sequence numbers, not the order of the <item entries.
Use your text editor fill feature to insert 0s to pad 1-digit sequence numbers to 2 digits. As a side effect, this will
align the item values.
Use your text editor to sort by the itemvalue field or order them
manually.
Make any last minute manual adjustment to move your favourites to the top or deadwood to the
bottom.
Do not insert or delete any lines.
Use your text editor to renumber/enumerate the index field.
Remove any lead zeros on any item.
Save and copy the modified file back on top of the official workspace.xml.
Fire up IntelliJ and enjoy the tidied order.
If you don’t like it, copy the backup of workspace.xml on top of the
official version.
If your run configurations suddenly disappear, examine
J:\intellij\mp\.idea\workspace.xml to see if they
are still in there. If they are, do an open project in the menu, for a project or module containing that workspace.xml. This is by far the easiest way to recover.
If they are not,
study all the workspace.xml files in the source code tree. Extract the
configurations, massage as needed, and insert them into the active workspace.xml
file. You will also have to adjust the <item index. You can also try restoring your
active workspace.xml from backup.
To install a plug-in, find it in the column on the right and right click it.
Install the PluginUpdateNotifier to let you know about updates to your
plugins.
Let’s say you wanted to convert all your System.out.println to
out.println with an
import staticjava.lang.System.out
at the top. How do you get all the imports only in the files where needed? Just use a
bulk regex search replace to insert imports just after the package statement for all plausible classes. Then do a bulk Optimise Imports/Reformat code to tidy the imports. The optimise discards the unneeded
imports, sorts and aligns them.
If IntelliJ gets sluggish, you will want to buy some more RAM, get a cheap SSD flash drive and
boost the amount of virtual address space allocated to IntelliJ Idea. IntelliJ hides the command line options
for the JVM
it uses while running. They are stored in
"X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\bin\idea.exe.vmoptions". Here are
the IntelliJ’s default settings for 32-bit.
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-ea enable assertions
If you have lots of memory you might bump up the size of some of those memory pools. These are just
standard java.exe options.
If IntelliJ behaves strangely, make sure these files have not been corrupted.
Last revised/verified:2014-04-26 Make sure there is a linefeed after the
final line of the configuration file or IntelliJ won’t even start. The options have the usual meaning
they would have on the java.exe command line. If you crank the memory pool sizes up to high, garbage collection
takes too long and the machine goes unresponsive for unacceptably long periods, even though performance
improves generally. Hopefully the Jet and the JetBrains people will get
together and make Idea work under Jet. The Jet JVM
is self-tweaking. Every time you install an update to IntelliJ, you will need to readjust these values.
You have to experiment to find out where IntelliJ is looking for resources this month: try
J:\intellij\mp\out\production\J8com\xxx\xxx\image\ or J:\intellij\mp\j8\src\com\xxx\xxx\image\.
Experiment to find out where IntelliJ is putting your class files. It may change its mind from time to
time. Look for recent timestamps. Right now, for me, it is putting them in
J:\intellij\mp\out\production\J8\com\xxx\xxx\
Use Help ⇒ Default Keymap to get a Printable PDF
IntelliJ cheat sheet of all the keystrokes and print it out. The type is tiny, but because it is a
PDF, a print shop can blow it up to a
full-size poster without loss of resolution. There are lots of
commands you won’t find on the menus.
You can change the theme/skin/look &feel with Settings ⇒ Appearance ⇒
Look & Feel.
Use Ctrl + Shift + Backspace to navigate back to the previous edit
location.
Projects can only see files in the same project unless you configure otherwise. You must add the
module library of class files of some other project as a dependency. Add the class files, not the source. Then attach sources to
the corresponding class files. If you simply attach the source files, when you hit Ctrl-B you will see decompiled class files, not the original source.
When you add the content root (where the source and other project files are) to a
module, add the entire module directory not just module\src\.
TODOs are not hidden tags like breakpoints. They are ordinary comments of the form //
TODO. You can configure other text and comments to be treated as TODOs. There is no special command to
create them.
Use the Analyse ⇒ Inspect feature. It does all kinds of wonderful things
like detect code of the form if ( expectedValue == expectedValue ) where you meant if ( actualValue ==
expectedValue ). It will tell you about variables you never set but never use. It will
add finals appropriately. It will reduce scope. It detects missing periods in Javadoc.
It will reformulate Boolean nests into simpler code. But best of all, it detects when you used ==when you should have used equals.
Use Alt + Enter to get light-bulb = on how to improve your code, such as
converting concatenation to explicit StringBuilders where you can add a proper
length estimate.
When the results of your find-all or find-uses disappear, you can bring them back by clicking the find tab on the bottom left of your screen.
Turn off auto-scroll-from source to stop IntelliJ from losing your place in the
navigation window.
Ctrl + Q on a method to see its Javadoc. It will show you the
up-to-the-second changes, not what was generated on the last Javadoc utility run.
To see the definition of a something in you code, use Ctrl-B, but if you
want to see the code for something not in the current code, use Ctrl+Alt+Shift-N
(Go To | Symbol)
When you install a new version, it will put it in a new directory and ask you where configuration files are
from a previous version to copy over. Give it the
"X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\"
directory, not the C:\Users\user\.IntelliJIdea2017.3\
directory.
Don’t delete the old version until you have used a new version for a week or so and are sure all the
configurations are copied over into the new version. IntelliJ does not install over top of the previous
version. When you install a new version, do not delete the
C:\Users\user\.IntelliJIdea2017.3\
directories as they are needed for the config information they contain
When you install a new version, it will ask you if you want to import the data from the old version. Oddly,
it does not want the C:\Users\user\.IntelliJIdea2017.3\ data.
It wants the "X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\" for the directory where the old version is.
Don’t run the code reformatter unless you have a clean compile. It will mess your code up so badly it
will require a lot of manual tidying to get it back in shape. Another reformat after recompile will not be
sufficient to get rid of dozens of unwanted newlines.
The registry entry for uninstall is at HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\IntelliJ IDEA
15.
Use the refactor ⇒ introduce constant carefully. If you factor out the
constant 4, all the 4s in the program will be
replaced, not just the ones in the particular context you refactored. This can create all manner of
hard-to-find bugs. Unless the numeric value of the String is distinctive, you are
best to do this manually.
If the module settings are disabled, click the module node and hit F4.
If you are debugging a program that reads resources from the jar, you must put a copy of the various
resources in the corresponding tree of the IntelliJ out directory next to the
*.class files the IDE
generates. I could not get it to work any other way.
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:
"X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\". This is
the program directory.
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.
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
your run/debug configurations are stored as XML
in J:\intellij\mp\.idea\workspace.xml
your code formatting configuration is in
C:\users\user\.IntelliJIdea2017.3\config\options\other.xml
Your options for the 32-bit Java run time
"X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\bin\idea.exe.vmoptions"
Your options for the 64-bit Java run time
"X:\Program Files\JetBrains\IntelliJ IDEA 2017.3\bin\idea64.exe.vmoptions"
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.
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy.
Please feel free to link to this page without explicit permission.
Canadian
Mind
Products
IP:[65.110.21.43]
Your face IP:[3.15.140.0]