
This README file explains how to use the example programs for
"Introduction to Programming Using Java, Version 9.0, Swing edition", 
which is freely available on the web at http://math.hws.edu/javanotes-swing

Although some exercise solutions will work with earlier versions,
Java 17 is required for many of them.  Information about getting
Java can be found in Section 2.6 of the book.

The web site for the textbook includes Java source code files 
for the examples in the book.  If you download the web site, 
you can find the files in a folder named "sources."  The example
programs are also available as a separate download.  The files are
arranged by chapter, with a folder inside "sources" for each chapter.
There are also links to individual files in the index.html file inside
"sources," or on the web at http://math.hws.edu/javanotes-swing/sources/index.html

You have several options for running the examples...


---- RUN IN AN IDE ----

If you want to run the examples in an IDE, such as Eclipse, you should
be able to copy-and-paste the entire contents of any one of the chapter folders
into a project in the IDE, and then run the programs.  Note: When adding items
to an Eclipse project, do not copy the chapter folder itself; open the 
folder and copy the contents into the src folder in the Eclipse project.
You can put the examples from several chapters into the same project if you 
want; some files, such as TextIO.java, are duplicated in several chapters,
but any two files with the same name are identical, and you only need one
copy of the file in your project.


---- COMPILE AND RUN ON THE COMMAND LINE ----

If you know how to compile programs on the command line, and if you have
downloaded the examples, you can easily compile and run all the examples.
Just change into one of the chapter directories inside  the "sources" 
directory, and use a command of the form

                  javac ExampleClassName.java
                  
For example:
                  javac HelloWorld.java
                  
As long as your compiler supports Java 17 or higher, there should be no errors.  
(You might see some warnings, especially if you use a newer version of Java, 
but warnings do not stop a program from being compiled or executed.)  You can 
then run the compiled programs using the java command.  For example:

                  java HelloWorld
                                    
Several examples from Chapter 12, Section 5 and the Mandelbrot Set example
from Chapter 13, Section 5 use packages.  The source files for these examples
can be found in the directories chapter12/netgame and chapter13/edu.  Compiling
and running programs from packages is a little harder; see the discussions in
the textbook in the relevant sections.
