Installing and Configuring a Java Development Environment
1 Something to Keep in Mind
It is a bad idea to use spaces in file names and/or directory names
since whitespace is often used as a delimiter. This includes
directories with names like My Documents
and John
Smith
.
2 Before Starting
Before you start to install the Java Development Environment you
may want to do the following:
- If you don't have one already, you should probably create a user
account on your personal computer with the same username as your
JMU eID. This will make it much easier to connect to JMU
computers (e.g., using SSH) and other computers that use your
JMU eID for authentication.
Regardless of whether or not you create such a user account:
- Create a directory/folder
for this course. As mentioned above,
do not include spaces anywhere in the path. (For example,
on my Linux machine, it is something
like
/home/bernstdh/cs300
.)
- Create a
downloads
directory/folder for this
course inside of the directory you created for this
course. (For example, on my Linux machine, it is something
like /home/bernstdh/cs300/downloads
.) This
directory/folder will be used to hold all of the files you
download for this course.
- Create an
eclipse
directory/folder inside of
the directory you created for this course. (For example, on my
Linux machine, it is something
like /home/bernstdh/cs300/eclipse
.) This
directory/folder will be used to hold your Eclipse Workspace and
all of the code you write for this course.
3 Installing the Java Development Tools
The first step in the process is to install the basic components.
-
Install the Java Development Kit Standard Edition v21.
You may use either the Oracle JDK (available from
Oracle.com)
or the OpenJDK (available from
Adoptium.net or
java.net).
You may install a more recent version but your code must not use
features beyond those in v21 and you must cross-compile your code
so that the .class
files are consistent with v21. (See
the
CS Wiki for help.)
-
Install Eclipse v2024-06
You may either
install it for the first time or, if you have an earlier
version installed,
upgrade your existing installation.
-
Select an Eclipse Workspace.
Start Eclipse. Then, when asked to select a workspace, browse to
the eclipse
directory/folder you created for this
course (e.g., /home/bernstdh/cs300/eclipse
).
For help, see the Departmental Wiki on
Eclipse workspaces.
-
Ensure that the Checkstyle Plugin was Installed.
Click on Help+About Eclipse
IDE+Installation Details, select the
"Installed Software" tab, and search the list for something
like "Eclipse Checkstyle Plugin". If it hasn't been installed,
install the Eclipse Checkstyle plugin.
- Download (using a right-click in most browsers) the
course formatter
for Eclipse and save it in an appropriate location
(e.g.,
/home/bernstdh/cs300/downloads
).
- Download (using a right-click in most browsers) the
course Checkstyle configuration/checks file and save it in an
appropriate location (e.g.,
/home/bernstdh/cs300/downloads
).
- Follow the instructions on the Department Wiki to
configure the Eclipse workspace to use the course
formatter. (You will use the same formatter for every
assignment. If you configure the workspace to use the
formatter, you will not have to configure each project
individually.)
- Follow the instructions on the Department wiki to
configure the Eclipse workspace to use the course
Checkstyle configuration/checks file. (You
will use the same style guide for every assignment. If you
configure the workspace to use the checks file,
you will not have to configure each project individually.)
- Click on Help+About Eclipse
IDE+Installation Details, select the
"Installed Software" tab, and search the list for something
like "EclEmma Java Code Coverage". If it hasn't been
installed, follow the instructions on the Department wiki to
install EclEmma.
- Check to see if the JUnit plug-in for Eclipse was installed by
looking under File-New for
JUnit Test Case. If it is not installed, you
can install it from the Help menu in Eclipse.
Note that the course formatter does not satisfy all of the
specifications in the course style guide. You may be able to modify
the formatter to make it more compliant but some of the
specifications must be dealt with manually.
4 Creating Projects
Each time you create a Java project in Eclipse, you must:
- Under "Project Layout", select "Create separate folders
for source and class files".
- Under "Module", un-select "Create module-info.java file".