For this project you will install and then explore three IDEs: Eclipse, NetBeans, IntelliJ IDEA. In any case, you will need to have installed the JDK too, which in turn includes a JRE. In addition, you will learn and explore using the non-GUI project and dependency management tool, Maven.
Complete directions for installing all software as used in the classroom can be found in the course resources, in the Java Setup link. (Those directions have not been updated for nearly a year, but they might still be useful.) What follows are the brief directions for setting up the three IDEs and Maven.
eclipse-inst-win64.exelink to download the Windows 64-bit installer. (Notice the “
.dmg” download link for Mac OS X users.) Run the installer. For our class, choose either the Java SE or Java EE packages. (The EE package includes everything in the SE package.)
An alternative to the installer is to download a zip of the version you want, from www.eclipse.org/downloads/packages/. The zip version can be installed on a flash drive, so you can take Eclipse with you and use from any computer!
For Windows, download the “zip” file for Eclipse (the 64-bit
version, if you have the 64-bit JDK) and extract
the contents into “
This creates a new sub-directory “
Open that folder and right-click on the file
Next you might want to make a short-cut on the start button.
With Windows 7, right-click on the
button and click on “
Next open the “
Right-click in this window and choose
With Windows 10, open the File Explorer and navigate to the folder
where Windows 10 stores your program shortcuts:
Right-click in this window and choose
(You can add additional short-cuts to your desktop or pin eclipse to the
quick launch bar, if desired.)
My Documents\Eclipse-workspace”. (You can click the button to make Eclipse remember your choice.)
You can also read the Eclipse Documentation online, especially the Workbench User Guide and the Java Development User Guide.
Additionally, you can read this tutorial which I found to be well-written: www.vogella.com/tutorials/Eclipse/article.html.
jarfiles placed into the Eclipse install directory. There are hundreds available to extend Eclipse with additional functionality, such as XML editors,
Junittest case editors, UML GUI drawing tools (that generate Java code for you), and Java EE tools.
A collection of these projects useful for Java and Java EE development has been bundled together, which is what you have installed (the current version of Eclipse). To install other Eclipse plug-ins not included with your installer bundle:
Install New Software...”. Now tell Eclipse where to look for the new plug-ins. You should select “--All Available Sites--”, but to add some third-party plug-in you need to add their site to the list, by clicking on the “Add...” button.
Install...button. For example, try adding Gonsole or the latest version of the Web Tools Platform (WTP), and click “Next”. This shows a summary of all the items that will be installed based on your choices. Click “Next” show the license screen; be sure to select the “I agree ...” button, then click on the “Finish” button to start the install.
Feel free to explore other available plug-ins. Even more plug-ins can be found at marketplace.eclipse.org. (Warning: You should learn the basic Eclipse platform first, because adding plug-ins complicates the user interface.) I like adding SpotBugs (replaces FindBugs).
Hello. (Be sure to check the “Generate comments” checkbox.) You should see a new file “
Hello.java” in the Package Explorer window. Right-click on it and chose open (or double-click it), and create a hello world (or other simple) application.
Oracle gave NetBeans to the Apache foundation. Apache recently (end of 2018) released the new version that works with Java 11. However, the website is not polished, and they are still working on porting the old documentation and updating it; much of it is very old.
netbeans) into “
C:\Program Files”. To launch, double-click
netbeans.exe. Follow the same steps as with Eclipse to add shortcuts to your Start menu or desktop.
I don't believe there is any official Apache NetBeans download for Mac OS X at this time, so you can skip this part if you only have a Mac. However, a student showed me a non-standard installer you can try. Follow the directions at github.com/carljmosca/netbeans-macos-bundle. (Note I've not tried this, so use at your own risk.)
You might want to read about Git, Maven, or other topics; examine the links for any guides/tutorials that seem interesting. (You won't have time to read them all now, but you should attempt to read some of them over time to improve your skills.)
Give your project a useful name (e.g., “
and pick a name for the class that will be generated
Note the NetBeans automatically puts your classes in a
package named after the project.
That is fine, but for this simple project, you could put your class in the
default, nameless package (or pick a different package name).
Leave “Create Main class” selected; note you can change the class
name if you want (I like
Run your project and make sure it is working. Make some deliberate errors in your program, and see how you can fix them using the NetBeans features (try right-clicking on the error).
IntelliJ IDEA (often just referred to as “IntelliJ” or “IDEA” IDE) is a popular commercial IDE from the company JetBrains. It comes in a free community edition (fully-featured but limited to Java SE) or in the commercial (costs money) “ultimate” edition (supports Java EE too). Currently, the ultimate edition is free for a year if you register as a student.
As with other IDEs, you can add plugins for extra functionality. I suggest you don't do that until you know the IDE better.
Click the checkbox to “Create project from template”, and select the command line application template. Click next.
Give your project a useful name (e.g., “
and pick a name for package.
For this simple project you could put your class in the
default, nameless package (or pick any package name).
Notice the template created a class named
You can rename that if you like.
Run your project and make sure it is working. Make some deliberate errors in your program, and see how you can fix them using the IDEA features (try right-clicking on the error).
Read the Maven in 5 Minutes tutorial.
C:\Java\(used in the directions that follow), but anyplace you wish is fine.
apache-maven-versionto something simpler, such as just
C:\Java\maven\bin(use the folder name you picked).
JAVA_HOME=C:\java(or whatever location you used for the JDK).
(As a reminder:
PATH is used by your system to locate executables
CLASSPATH is used
by Java to locate packages and some other things;
used by various programs (including Maven) to locate a JDK; and
M2_HOME (previously known as
MAVEN_HOME) is used by
mvn to locate various configuration files.
All of these may be used by other programs to locate files they need.
While some programs are smart enough to guess to try default install locations
when you don't set these variables, that won't work if you don't install
in the default locations.)
There are several ways do to this. One is to follow the standard install directions for a Linux-like system, found on the Maven website. The simplest way seems to be this:
brewcommand to install things.
brew install maven.
treecommand, you can install that using the command
brew install tree.
cdinto it. Next, create a working “Hello, World” project named “
hello” using the command (one long line):
mvn archetype:generate -DgroupId=cop2805 -DartifactId=hello -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
That might take a while the first time.
When done, see what files were created by using the
tree/F hello command
tree on Mac or Linux).
Also take a look in your home directory; you should see a new subdirectory
That's your personal Maven repo.
cdinto your new
hellodirectory. Take a look at the generated source code at
src/main/java/cop2805/App.java, the generated unit test at
src/main/java/cop2805/App.java, and the generated
pom.xmlfile. (When using Maven “for real”, you would edit the POM file and then edit or replace the
pom.xmlfile. The reason is, the current version of Maven's compile plugin tries to generate code compatible with Java 5 (“
javac -release 5 -source 5”), and Java 9 only supports Java 6 through 9. To fix, you need to add these four lines in your generated
<properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties>
(Don't set to “
1.9”, since Maven will not compile
Those lines can go anywhere between the initial <project> tag and the
final </project> tag, but not inside of any other tags.
Just above the final </project> tag is fine.
(Hopefully, a new version of that plugin will address that problem!)
~” means your home directory.). This is done with the simple command:
tree) command to see the new
(Also look in your home directory and use
tree on the
.m2 directory there.)
Notice the JAR file; that is the resulting application.
To run this Jar file, enter the command (without changing directories first):
java -cp target\hello-1.0-SNAPSHOT.jar cop2805.App
mvn site” to generate a website for your project. You can view the site in your web browser by opening the file “
mvn eclipse:eclipse”. If you import this project into Eclipse, it should just work.
A copy of your Java source code from the “Hello World” programs you created in parts I – IV, and the answers to the questions asked in part V.
When copying from Eclipse, copied code loses all formatting if any of the code is “folded” (hidden with a plus sign where the missing lines are). To avoid losing formatting when copying, first right click on the line numbers and select Folding → Expand All. Now when you copy, all formatting should still be there when you paste! (To prevent folding altogether, go to Window→preferences→java→editor→Folding, and select/unselect the various folding options.)
You can send as email to (preferred). If email is a problem for some reason, you can send a message to me using Canvas, and attach a zip of your files to it. Or, you may turn in a hard-copy as a last resort. In this case the pages should be readable, dated, and stapled together. Your name should appear on the first page.