Home || Syllabus || Class Notes || Assignments || Resources || Tutoring
Installing the NetBeans Software || Using the IDE || Troubleshooting
Instructions for installing the Java and the IDE: Netbeans - BlueJ edition
- Windows users will need to install JDK first (the Java Development Kit from Sun). JDK is available from Sun at http://java.sun.com/javase/downloads/index.jsp and instructions for installing the JDK bundle are posted here by Professor Marateck. (Note: You do NOT need to install JCreator to use NetBeans.)
- Go to http://www.bluej.org/netbeans/index.html and select Download the System Here. Be sure to select the correct version for your system (Windows) before you download. You may wish to read the instructions first.
On Mac OS X systems, Java is already available so you do not need to install it.
- Current versions are available at http://www.bluej.org/netbeans/index.html. Be sure to select the correct version for your system (Mac OS) before you download. Earlier versions of NetBeans/BlueJ edition can be found here.
Note and Explanation:
NetBeans - BlueJ Edition is available from NetBeans.org. An "IDE" - Integrated Development Environment - is a program that makes it easier to type in Java code and to run the programs. An IDE does not contain the Java itself; that is available from Sun.
Click here for further information on this IDE and others.
Instructions for using the IDE: Netbeans - BlueJ edition
Getting Started: writing and running programs:
For a new project (and getting started):
- FILE / NEW PROJECT / BlueJ / Empty BlueJ Project / Enter a project name & file location / FINISH
Then to start programming:
- FILE / NEW FILE / JAVA CLASSES / EMPTY JAVA FILE / NEXT / Enter a file name at the top of the screen; leave "Package" blank / FINISH.
- Now you can start typing your code or copy and paste from a model that we have done in class.
Adding line numbers to your screen:
- use F9 to compile the current file on Windows (on the Mac use the menu: BUILD / COMPILE FILE)
- use Shift + F6 to execute the current file (both Windows and Mac)
- Note: In Windows ... you can use the "BlueJ View" under Projects to right-click on your file and select "Compile" or "Run".
- Click on the line number of the first line in main (after the opening brace) to set a breakpoint; this should color the line in a dark pink.
- use Run / Run Other / Debug <filename> or CTRL + shift + F5 to start a debugging session in your file
- use F8 to step through your program, line by line within main. To step through additional methods, use F7.
Note: It is cumbersome to try to debug through a JOptionPane statement; it is easier to comment out the JOptionPane statement and follow it with an initialization, such
/* String sentence=JOptionPane.showInputDialog(null, "Type in a sentence",
"Input Sentence Window", JOptionPane.QUESTION_MESSAGE); */
String sentence = "The caT is AsleEp." ;
- Use Run / Finish Debugger Session to end
- Click on the line number of your breakpoint line to remove the breakpoint
- Use Window / Debugger Window to seleect the Watch window
- Right-click on the PC with your cursor in the Watch window or use CTRL+Shift+F7 to add variables to the Watch Window
- If you can't step through a program: Try assigning literals to your variables and comment out the JOptionPane dialogue boxes for data entry when you wish to step through a program; this will simplify the process. When your program works to your satisfaction, you can remove the comments and query the user for the input values.
- If you run out of memory, it could be that there are too many processes running simultaneously. This can happen if you run a program and it crashes but the process has not been terminated or if you omit the line System.exit(0) .... save your work, exit, and re-start.
- Use the menus rather than shortcuts (for example, use BUILD / COMPILE FILE rather than "F9"
- Be sure to create a new folder on your system to hold your programs rather than trying to use the default folder. (NetBeans uses a hidden folder for the default directory location.) Use FILE / MOUNT FILESYSTEM to be able to use that folder for your programs.
- Try CTRL-C and CTRL-V to copy and paste ... rather than using the command key.
- Use F7 and F8 to step through programs just as you would on the PC.
- In order to add variables to a watch window, use CTRL+click to obtain the menu.
- If you run into any "bootstrap" errors (which is to say that your program runs but you get a lengthy error with the word "bootstrap" in the first part) , it could be a result of using the JOptionPane command. In order to work around this, include the following line right after the JOptionPage statement: