Jump to content

The RuneLocus forum has been archived and does not accept new registrations.
Click here for more information, and click here to join the community on Discord.

Getting started with IntelliJ


Recommended Posts

1. What is IntelliJ?

IntelliJ is a program (an IDE) that aids software development with various tools like code completion, debugging, version control and many, many other things. It is a necessary tool for every professional developer and, as a professional developer you will use it every day. Many of you are probably familiar with Eclipse. That is also an IDE. IntelliJ is just a more professional, robust and flexible platform. Eclipse used to be the IDE of choice because it is free and IntelliJ was not. Now however Jetbrains has a version of IntelliJ called the Community Edition and you can download it from the Jetbrains website.

It is quite hard to explain why IntelliJ is the smarter choice when picking an IDE. It excels at many (if not all) features and you quickly become used to its luxury. The downside is that you cannot productively use it if you have a bad computer as it does require a decent amount of resources (but not so much that a normal computer cannot handle it).

2. IntelliJ goodies

2.1. Context-aware code completion

IntelliJ has by far the best code completion for the broadest range of frameworks than any other IDE. It's incredibly fast and it's nearly always spot on. Also live templates are very useful and context-aware. Live templates are code templates that you can generate while typing code.

For example:



2.2. Excellent debugging

See the IntelliJ Debugger page and take note of the Evaluate Expression (and fragment mode) tab that lets you run any code you type while debugging.

2.3. Easy to use and slick GUI

Back in the day IntelliJ was labeled as hard to use GUI and many RSPS people were unable to figure it out. However this is no longer true. The GUI is very intuitive and if you know something about what you are doing you will quickly get what everything means and what everything is for.

2.4. Modules

Because Eclipse has a workspace with multiple projects in it, people who check out IntelliJ are often spooked away by the fact that IntelliJ has no such thing as a workspace. The closest you can get is having one project with multiple modules, or having multiple projects open in different windows. The semantic meaning of a module in IntelliJ is a piece of a modular program where each module can be (re-)used independently without having to import the entire program. In the professional world projects usually have many (10+) modules depending on the size that all mark "blocks" of the program and thus can be used independently.

I say independently, but modules can depend on eachother, it just means that they don't depend on the entire application.

3. RSPS project in IntelliJ

3.1. Project Setup

In IntelliJ, and every other IDE for that matter, a project is just a folder that contains some project files. (.idea and .iml in IntelliJ, .classpath and .settings in Eclipse). This means that, everything in that folder is a part of your project and it will show up in IntelliJ. For example; you can simply copy the cache folder to the project folder and it'll be a part of your project.

I recommend making a new project (instead of making a project from existing sources). Then copy your client and server folders to the project folder. Back in IntelliJ, you then create new modules from existing sources for:

  1. Client
  2. Server

IntelliJ will automatically scan for libraries and sources and optional frameworks used.

Even though this is not how modules should be used, they can be, and it works perfectly. It makes it easier to navigate between code and keeps your project in one window.

3.2. Explanation of Current Working Directory

The current working directory (CWD) is, as its name suggests, the directory you're currently working in. More specifically, the directory, Java, your shell, or any other executable uses as its "base of operations". It can also mean the currently selected folder. Any relative path you create is resolved to the current working directory.

  • "." resolves to the CWD path same as "" (just an empty string).
  • ".." goes up a folder.


3.3. Run configurations

Run configurations are simmilar to those in Eclipse. They are configurations responsible for telling IntelliJ what to run and how to do it.

For example: I want to run my server. The server sits in the module called "Arixscape Server" and has a main class org.base.ServerMain. To tell IntelliJ to run it, I make a run configuration for a Java Application with main class org.base.ServerMain in the module "Arixscape Server" like so:


Notice the "Working directory". I need to use the module directory as the Current Working Directory (aka "base of operations") so that the server correctly finds all the resources in its directory.

Notice "Program arguments". These arguments are what appear in the argument array of your main method. True true false taken as example for 718 matrix servers.

Notice "Use classpath of module". This tells IntelliJ to use only the classes and libraries in the Arixscape Server module. Very important.

Notice "Single instance only". This is optional but can be handy. When marked, only one instance of the configuration can be running. When you run the configuration again, it will stop first if it's running, then run again.

Important: When running a client in IntelliJ, you may notice it's unable to enter HD mode with DirectX or OpenGL. This is because of missing native dependencies in the JDK that is used by default to run things in IntelliJ. To overcome this issue, in the client run configuration, you select your actual JRE (not JDK) in the "JRE" field of your configuration. This will fix the client problems as the JRE does contain those dependencies. It took me MONTHS to find this issue.

3.4. Artifacts

Artifacts are things you can build from your application such as jars. You create an artifact that builds a module into a jar and you're done. When you want to create a client jar, you create an artifact definition and build it. It's a very easy process.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...