This got linked in a Discord pinned post recently, so here's a text version for anyone who just wants to know
"How do I modify my code in NetBeans without restarting Starsector"?
Using the debugger in NetBeans(for Windows, should work similarly for Linux/Mac by editing different files)
Make a copy of starsector.bat and name it starsector_debug.bat. Replace its contents with, e.g.:
..\jre\bin\java.exe -Djava.library.path=native\windows -Xms4g -Xmx4g -Xss2048k -XX:MaxPermSize=128m -Dcom.fs.starfarer.settings.paths.logs=. -Dcom.fs.starfarer.settings.paths.saves=../saves -Dcom.fs.starfarer.settings.paths.screenshots=../screenshots -Dcom.fs.starfarer.settings.paths.mods=../mods -classpath janino.jar;commons-compiler.jar;commons-compiler-jdk.jar;starfarer.res.jar;starfarer.api.jar;starfarer_obf.jar;jogg-0.0.7.jar;jorbis-0.0.15.jar;json.jar;lwjgl.jar;lwjgl_util_applet.jar;jinput.jar;lwjgl_test.jar;log4j-1.2.9.jar;lwjgl_util.jar;fs.sound_obf.jar;fs.common_obf.jar;xstream-1.4.10.jar -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8888,suspend=n com.fs.starfarer.StarfarerLauncher
PAUSE
(RAM allocation here is 4G, change it if needed)
The relevant addition (compared to the unmodified .bat) is:
-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8888,suspend=n
This allows the external debugger to attach to Starsector.
In NetBeans, after launching Starsector
using your new .bat file, go to Debug -> Attach Debugger and enter the details in the window that pops up as shown below:
You should now have the NetBeans debugger attached to SS.
To make your modified code be reflected ingame, click the Apply Code Changes button at the top of the window:
LimitationsYou cannot do certain things like add/remove methods, or change their params or return types.
I've also found that changes to static final objects (as opposed to primitives) may fail to "take".