BlueJ provides a different level of interactions with the user than
any typical Java environment. Every program execution is just an
interactive invocation of a method defined in one of the user-defined
classes by an instance of an object created in the Object
Viewer.
Download the BlueJ from the XXX website and follow the
instructions to install the software
Save the ProfessorJ program you want to run in
BlueJ, say in the directory
.../ProfJPrograms. Assume the file name is books-authors.java
Create a directory where you will keep the BlueJ projects,
say .../BlueJ
Create a subdirectory .../BlueJ/Libraries of your
.../BlueJ directory where you will keep any library
files your project may need
Download the file tester.jar into the .../BlueJ/Libraries
directory
Download the file ConvertBJ.zip into the .../BlueJ
directory and unzip it there
Start the BlueJ application
In the Project menu select Open Project then
select the ConvertBJ project.
Now get ready for the first BlueJ project you will
run. In the Project menu select Open Project then
select the MyProjectBJ project.
In the Options menu select Preferences and in
the Editor section select Display line
numbers. This way you can easily find the line for which an
error is reported.
Now choose the Libraries section of the BlueJ:
Preferences window and select Add.
In the file chooser dialog find the file
.../BlueJ/Libraries/tester.jar then hit OK in the
BlueJ: Preferences window
Right click on the ConverterBJ box in the main window
and select void main(String[])
In the BlueJ: Method Call dialog that opens up select
OK
You will see a file dialog opened three times. The first time it
asks you to choose the ProfessorJ file to be
converted. Choose the books-authors.java in the
.../ProfJPrograms directory
The second file dialog asks for the name of the file (and a
correct directory) where to save the class definitions part of your
program. Select .../BlueJ/MyProjectBJ/books-authors-bj.java
The third file dialog asks for the name of the file (and a
correct directory) where to save the Examples class for
your program. Select
.../BlueJ/MyProjectBJ/examples-books-authors.java
You are now ready to run your project in BlueJ. Select
the window for the MyProjectBJ
In the Edit directory select Add Class From
File ... then select the book-authors-bj.java file.
In the Edit directory select Add Class From
File ... then select the examples-book-authors-bj.java
file.
Your program is almost ready to run. Double click on the box
books-authors-bj.java and edit it by adding the
necessary visibility modifiers to the method definitions for methods
required when the class implements an interface. By definition all
methods defined in an interface are considered to have public
visibility and all implementing methods have to match this. Add the
word public before the header of every method that is
required to implement an interface.
Click on the Compile button on the top left and make
sure the message on the bottom indicates Class compiled - no
syntax errors
Right click on the box examples-book-authors-bj.java
and select Compile. You should again get a message
Class compiled - no syntax errors
Right click on the box that now should be labeled
Examples ( or whatever the name of your Examples
class is) and select new Examples()
Select the name of this instance - accept the suggestion
examples1. A red bow will appear in the bottom left frame
Right click on this red box and select void run(). The
printout of all fields defined in the Examples class as
well as the test results will be displayed in the BlueJ:
Terminal Window - MyProjectBJ window