Apache NetBeans Wiki Index

Note: These pages are being reviewed.

Demo Script


  1. NetBeans 6.0 (tested against 20070419 ~ M9)

    1. JDK 6.0u1

    2. Any supported OS (tested on Ubuntu)


  1. Create a Java application.

    1. Add to the main method:

  System.out.println("First main class.");
  1. Add a new Java main class. Add to its main method:

System.out.println("Second main class.");
  1. Click Run (F6). You should see

First main class.

Demo steps:

  1. From the <default> combo in the toolbar, select Customize…​.

    1. Click New…​ (configuration).

    2. Enter name second and click OK.

    3. Click Browse…​ (for main class).

    4. Pick the second class and click Select Main Class.

    5. Click OK to close the Properties dialog.

    6. Click Run; you should see

Second main class.
  1. Choose <default> again in the combo and click Run; you should see the first main class again.

    1. Right-click the project and choose Properties.

    2. Under Run, switch to second configuration.

    3. Add -showversion to VM Options. Note that the field’s label becomes boldfaced.

    4. Click OK and Run; you should see

java version "1.6.0_01"
JavaTM SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpotTM Server VM (build 1.6.0_01-b06, mixed mode)

Second main class.

Optional material

Question: Can I control other things besides Run options?

Answer: You can, though for at least for 6.0 this is not supported through the GUI. For example, go to the Files tab and open nbproject/configs/ Add:


With the configuration set to second, press Clean and Build Main Project (S-F11). You should see

Compiling 2 source files to /tmp/JavaApplication1/build/classes
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)


Generally, anything normally set in can be overridden on a per-configuration basis. The Properties dialog outside the Run panel will only show the contents of, however.