Skip to content

Building with IntelliJ IDEA

chsami edited this page Aug 13, 2023 · 3 revisions

Table of Contents

Getting started

For working with this project, IntelliJ IDEA is our recommended IDE and the one used by most collaborators. The free community edition has everything you'll need to start testing and contributing real improvements to the project.

You can build RuneLite locally using JDK 11. We recommend installing the JDK through IntelliJ and selecting vendor Eclipse Temurin (AdoptOpenJDK HotSpot) version 11. The codebase supports language features up to Java 11.

Importing the project

After launching IntelliJ IDEA for first time, you will see IntelliJ welcome window. You will now need to clone RuneLite repository from git:

welcome-import-git

After clicking on that you will be greeted with prompt. You can either enter the RuneLite repository https://github.com/runelite/runelite or your own GitHub fork, if you've created one.

NOTE: If you plan to make a Pull Request, you must fork the RuneLite repository, and clone from your fork.

The prompt should look something like this (if you have issues with finding git.exe see Troubleshooting section):

welcome-clone-project

Click Test to verify if your entered URL is correct and then click on Clone. Now IntelliJ should start cloning the repository:

welcome-cloning-project

After the cloning process is done you should be greeted with prompt asking you if you want to open the project, just click Yes:

after-clone-yes-no

If everything went well, you should be able to see something like this:

after-clone-fresh-project

Building the project

RuneLite is using Maven as build tool. It is used for dependency management, resource generation, running tests and any other tooling needed to properly build, run and deploy RuneLite.

So, to actually run RuneLite, we first need to invoke Maven.

Locate Maven on right-side of the screen until you open something like this:

project-maven-view

Standard maven goal is Install so let's run that. Locate Runelite (root) project in dropdown and navigate to RuneLite (root) -> Lifecycle -> Install and right-click the option and select Run Maven Build:

run-maven-install

If you are having issues with missing JDK see Troubleshooting section. You can now save this build step as Run configuration, just right click Install again and select Create.. (Modify Run Configuration... in IntelliJ 2021.2), window like this should pop-up, so just hit Ok (you can append -DskipTests for faster builds):

project-maven-install-save

Now, we need to tell IntelliJ to pick up changes based on Maven build (it should do that automatically, but sometimes it doesn't). So, still in same Maven window, just click the Refresh icon:

project-maven-refresh

Running the project

Now locate Project in sidebar and click that open project view, and expand the tree to runelite/runelite-client/src/main/java/net/runelite/client. And all you need to do now is right-click RuneLite class and select run, and you are done, RuneLite should open:

project-view-run-main

If you are having any issues with this step see Troubleshooting section.

Conclusion

Success! You can switch between running the client and building the Maven project by switching between the RuneLite configuration and your custom Maven configuration (should be named runelite-parent [install] by default):

select-run-config

Troubleshooting

Missing git

If you are getting error about git.exe (or git on linux and mac) missing, you will need to first download and install Git for your OS. Git is version control software and implementation that RuneLite uses to store and track history of it's source code. To download git, just go here and select your OS version.

Missing JDK

If you are getting errors about missing JDK, make sure to install JDK 11 (see start of this page) and then navigate to File -> Project Structure like this:

missing-jdk-project-structure

Then press + button and Add JDK and locate directory of your installed JDK:

missing-jdk-add

Client failing to start

If the client fails to boot or if the applet does not appear, try running the Maven build again with the following command:
clean install -DskipTests -U mvn-clean-install

If that also doesn't work, feel free to ask for help in the discord server. Here are few helpful tips:

Make sure your branch is up to date with master

To sync your fork simply run

git checkout master && git fetch upstream && git rebase upstream/master && git checkout - && git rebase -

or update the project from IntelliJ:

update-project

Make sure IntelliJ is picking up changes from Maven

If you are unsure, run: Maven Projects > Reimport all maven projects in IntelliJ (or Ctrl + Shift + A and type Reimport all maven project).

Happy development!

JDKs 16+

You have to add the following extra VM arguments in order to use these java versions:

Windows/Linux
--add-opens=java.desktop/sun.awt=ALL-UNNAMED
Mac
--add-opens=java.desktop/com.apple.eawt=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED
Clone this wiki locally