| Requirement | Version |
|---|---|
| NetBeans IDE | 23.0 (RELEASE230) or later |
| Java | 17 (required; Java 25 is not supported) |
| Maven | 3.6+ |
| Git | any recent version |
The plugin uses sun.misc.Unsafe and reflection APIs that are encapsulated by default in Java 17+.
Without these flags, opening any .kt file triggers ExceptionInInitializerError in
AtomicFieldUpdater and the Kotlin environment never loads.
Apply these flags before launching NetBeans for the first time with the plugin.
# Replace 27 with your NetBeans major version (check Help → About)
NB_VERSION=27
mkdir -p ~/.netbeans/${NB_VERSION}/etc
cat >> ~/.netbeans/${NB_VERSION}/etc/netbeans.conf << 'EOF'
netbeans_default_options="$netbeans_default_options -J--add-opens=java.base/java.lang.reflect=ALL-UNNAMED -J--add-opens=jdk.unsupported/sun.misc=ALL-UNNAMED -J--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -J--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED"
EOFVerify:
grep "add-opens" ~/.netbeans/${NB_VERSION}/etc/netbeans.confsudo sed -i \
's|-J--add-opens=java.base/java.lang=ALL-UNNAMED|-J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.base/java.lang.reflect=ALL-UNNAMED -J--add-opens=jdk.unsupported/sun.misc=ALL-UNNAMED -J--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -J--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED|' \
/usr/lib/apache-netbeans/etc/netbeans.confDownload the latest .nbm file from GitHub Releases.
Intermediate builds between releases are available as artifacts on the
Actions page — open the latest
successful workflow run and download the nbm artifact (delivered as a zip file; extract
the .nbm before installing).
- Open NetBeans → Tools → Plugins
- Switch to the Downloaded tab
- Click Add Plugins… and select the
.nbmfile - Click Install and follow the wizard (accept the license when prompted)
- Restart NetBeans when prompted
git clone --recurse-submodules https://github.com/nbplugins/NetbeansPluginKotlin.git
cd NetbeansPluginKotlinThe plugin depends on bundled JARs that are not published to Maven Central. Install them once:
bash setup-local-repo.shRe-run this script any time a JAR in lib/ is updated.
JAVA_HOME=/usr/lib/jvm/java-17-temurin-jdk mvn clean package -DskipTestsThe .nbm file is produced at target/kotlin-netbeans-*.nbm.
- Open NetBeans IDE.
- Go to Tools → Plugins.
- Switch to the Downloaded tab.
- Click Add Plugins… and select the
.nbmfile fromtarget/. - Click Install and follow the wizard (accept the license when prompted).
- Restart NetBeans when asked.
- Restart NetBeans after adding the JVM flags.
- Open or create a
.ktfile — you should see Kotlin syntax highlighting and code completion.
If the editor shows plain text with no highlighting, check the log:
grep -i "kotlin\|AtomicFieldUpdater\|ExceptionInInitializerError" \
~/.netbeans/<version>/var/log/messages.log | tail -30Common causes:
| Symptom | Cause | Fix |
|---|---|---|
No highlighting, ExceptionInInitializerError in log |
Missing --add-opens flags |
Add the JVM flags and restart |
Build fails with NoSuchMethodError |
Local Maven repo not populated | Run bash setup-local-repo.sh |
| Build fails with wrong Java version error | Wrong JAVA_HOME |
Set JAVA_HOME to Java 17 |
# Full test suite
JAVA_HOME=/usr/lib/jvm/java-17-temurin-jdk mvn clean test
# Single test class
JAVA_HOME=/usr/lib/jvm/java-17-temurin-jdk mvn test -Dtest=ClassNameTests require a display. On headless servers, Xvfb is started automatically by Maven on display :99.