X

Geertjan's Blog

  • January 24, 2006

Set Runtime and JVM Arguments... Per Class!

Geertjan Wielenga
Product Manager
Ever since writing Provide Runtime Arguments for Selected Class Files in NetBeans IDE 4.1, I've been in touch with Iván Rivera Rodríguez, from Spain. His first e-mail to me started:

This exact limitation has prompted nearly all of the co-workers to whom I pitched NB4.1 to reject it and go straight back to 3.6 --except for the Eclipse fanboys, of course ;-). Most of them aren't fond of writing Ant tasks to perform "such basic tasks, that NetBeans 3.6 performs without problems" (their words).

The e-mail continued:

Such was the humiliation (I love the new NetBeans) that I set out to learn the OpenAPIs (and anything else related) to create a module for them, providing this piece of lost functionality, the Set Arguments... command. If you are interested, I can provide sources for you to study; I am somewhat wary of publishing it as I am in no situation to handle its maintenance (you know, all work and no play...); however, it sort of works in its current form.

Since then, we've been corresponding off and on a bit now and then... until... the last week or so. We started corresponding more regularly, because he was putting the finishing touches to his module. It now works for NetBeans IDE 5.0 (except, currently it only works if you're using a post 5.0 development build that you can get from the Download page on www.netbeans.org). Once you've installed Iván's module (go to my Update Center, and you'll find a module called "Execution Profile"), all your main classes will have a new node:

You can then, for each main class, specify execution (i.e., runtime) arguments, JVM arguments, and the Java platform against which the file executes:

Not bad, right? Especially considering that this missing functionality is a stumbling block for many people—I've seen this come up over and over again on mailing lists. (By the way, there's also a NetBeans IDE 4.1 version of this module, but I haven't been able to work out how to create an autoupdate descriptor for it, so I couldn't put it in my Update Center. If you want it, please leave a message here. And, remember, the version in my Update Center will not work if you're using Beta 1, Beta 2, RC1 or RC2. You must get/have a post 5.0 development build from the Update Center.)

Finally, the module also contains a set of help files, so if you're stuck, lost, and confused, go here:

And, here's the exact spot where you'll find Iván's module:

Join the discussion

Comments ( 9 )
  • giorgio Tuesday, January 24, 2006
    Please make this module compatible with 5.0FCS! Please! Please!!
  • Kovica Wednesday, January 25, 2006
    Yes. I'd also like to see this module for 5.0! I hate not being able to run non-main-project classes with their proper agruments like in 3.6 :((
  • johnc Wednesday, January 25, 2006
    I like adding this functionality, have definintely think it should be implemented in a property in the node property sheet instead of as a subnode. Nodes are usually meant to be a physical thing, usually code or part of code, not options that you apply to that code when you run. Also, nodes are supposed to be for things that you need to access often. For most execution properties, I think you set it once or not at all, not repeatedly. But with a subnode, you're forced to always see it, whether you use it or not.
    Anyway, don't mean to dirt on it, I think this is important functionality that we should be providing. Just the UI should be a little less intrusive and fit into the NetBeans UI paradigm a bit better. It would be good to send email to nbui@netbeans.org for suggestions as well.
    Keep the plug-ins coming!!!
  • Iván Rivera Wednesday, January 25, 2006
    I thought of that one when developing the module. Trouble was, there was no way I could integrate the needed functionality inside the JavaNodes. What I wanted to do was to add a new property sheet to JavaNodes representing Execution Profile elements; however, no API allowed me to plug in that sheet from a module (i.e., without modifying the NetBeans code itself), at least when I started to develop the module (NB4.1). I don't know if that's the case now...
  • Jean-Marie White Wednesday, January 25, 2006
    It would be nice (and competitive against Eclipse) if you could also set environment variables. (You can't do it at all right now). This is critical when you integrate with JNI libraries that in turn depend on other libraries (a shared object in linux doesn't know anything about the java.library.path and must be configured using LD_LIBRARY_PATH).
  • Thomas Zillinger Friday, November 17, 2006
    Is Execution Profile also working for Netbeans 5.5?
  • Thomas Zillinger Friday, November 17, 2006
    A ja, could you please also tell me where can I get it from, since it doesn't seem to be in your Update center (http://blogs.sun.com/roller/resources/geertjan/updates_geertjan.xml) anymore....
  • Geertjan Friday, November 17, 2006
    See www.nbextras.org
  • Thomas Zillinger Friday, November 17, 2006
    Oh thanks, great! :)
    One other question, for some reason debugging together with the profile does not work, it would not take the arguements from the profile - ('is this a feature or a bug...' :) )
    Is there a way to make debugging working?
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.