Toomas Römer

Netbeans – running programs the easy way

March 31st, 2009 | by Toomas Römer |

I have not been so angry at an IDE for a while, arrrrrrrghhh, rant follows.

How hard can it be to add JVM arguments to the run configuration of an application when running it from an IDE? Lets say I want to add -Dsuperboost=true or just ~/myconf/.myconf to the Java application?

Eclipse has a green button and Run configurations under it, there you can specify Program arguments and VM arguments. Easy.

IntelliJ Idea has a green button and Edit Configurations under it, there you can specify Program parameters and VM parameters. Easy.

Netbeans has a green button. Thats it. Where are the options? When you check project Properties there is Build » Compiling & Packaging but no run. Googling for such a generic topic does not help me much, just aggrevates more.

Finally I realize, everything is ANT based, I’ll just modify the build.xml files used. The toplevel build.xml includes project/nbproject/build-impl.xml, this includes some NetBeans bundled build.xml. Okay, this is not the best place.

I find a file named project.properties with two options in it, javac.compilerargs and javac.source. Jackpot, I’ve found the hidden settings, I just need to figure out the magic names that I could add. Some more googling and trying out different flags from different NetBeans versions I’m still out of luck, I’m unable to guess the names.

Finally I went through NetBeans/harness/build.xml » common.xml » run.xml and the magic secret hidden flags follow:

  • run.jdkhome
  • run.args.common
  • run.args.prepared
  • run.args
  • run.args.extra

Weeehah! Now I need only to add “-noverify”. No, more like “-J-Xverify:none”, argghh.

  • javazoneparticipant
    Hello, I attended to your talk on Aranea at JavaZone a few years back. I'd like to hear more from you this year on classloading. A non-technical word of advice though:

    Slow down and speak clearly!

    It was impossible to get half of the interresting stuff you had to say about Aranea, which was really frustrating for the listeners.

    Best of luck on JavaZone.
  • Steve Webb
    I'm just using NB 6.5.
  • Toomas Römer
    No such thing as "set configuration". I guess I have a different type of project, weird 7 devel build and no way to set arguments.
  • Steve Webb
    Don't see any problem myself just right click on project and select set configuration !!!

    Or another option is right click project and select properties, its in a tab within there.
  • Toomas Römer
    Well I did solve my problem, don't want to fiddle with the settings any more.

    I do think that something so trivial should not be so difficult.

    Reminds me kind of Gnome. Everything is super easy until you need to configure something that is not in the UI. Either google until your fingers bleed or grep the goddamn magic keys from the source code.
  • Markus
    Ok, that setting doesn't work for Netbeans Platform or Module projects. They have a very different way of starting and setting parameters.

    Is it a Platform suite? Then change Project Properties under the "Important Files" node.

    For a single module you load in a clone of the IDE, I think it will inherit the setting in the parent Netbeans. Those settings are done in etc/netbeans.conf.
  • Toomas Römer
    This is greyed out. I clicked on the project to give it focus but still the "Set project configuration" is greyed out. My project is the sample Netbeans module project called Feed Reader.
  • Markus
    Run / Set Project Configuration / Customize.
blog comments powered by Disqus