Java Classroom Setup Directions

(Last updated:  March 6, 2018)

This document describes the steps to install and configure the various Java development tools used in COP-2805C.  Please note that many of the install locations and settings are my personal preferences, and that installing to different locations and using different environment variable settings is certainly acceptable; whatever works best for you.  Note the setup described here conforms to Oracle (formerly Sun) recommendations for the JDK and JRE setup.

For all tools, when there is a choice use the 64-bit version on a 64-bit computer.  Only use 32-bit versions if you are using an older 32-bit computer and a 32-bit OS.

Web browsers are mostly 32-bit today, and won't work with 64-bit plugins such as the JRE plug-in.  However, most popular web browsers today no longer support old-style plug-ins anyway, so Java Applets won't work regardless.

If you wish to use Java applets, you should install an appropriate browser such as Pale Moon that still supports the old plug-in API (“NSAPI”), and then install the 32-bit versions of Java and other tools (such as Eclipse), instead of the 64-bit versions.  Many tools will work regardless of the Java type you install, but not Eclipse and possibly others.  Finally, note that Oracle has announce that applet support (the web browser plugin) will be deprecated in Java 9 and eliminated in a future release.

In our course we will explore many tools, including the Eclipse IDE (and possibly others such as NetBeans).  The IDEs often include bundled versions of some tools, such as Ant, JUnit, and Maven.  While you could locate where these were installed by your IDE and configure these tool names to refer to those locations (so you can use them with the command line or another IDE), these tools are small and it doesn't hurt to install the extra copy.  By installing the tools separately (and before any IDEs), you can access them easily from the command line and update them when updates are available, without waiting for an update from your IDE, which may cause you to have to reconfigure other tools to know about the new locations and pathnames.

One of my personal preferences is to install tools into directories without version numbers.  Then if I update some tool and put the new version into the same location, I don't have to update any environment variables or reconfigure any IDE settings to know about the new locations.

The order you download and install tools may not matter much, but I like to install and configure the environment variables for some tools before installing IDEs or the Wildfly or Glassfish Java EE server.  (There is a chance those installers will locate the tools and configure themselves to use those locations, rather than install a separate version.  Even if they don't, I have found in the past the NetBeans install of Glassfish isn't current, and doesn't update properly.)

Note that these directions are tested on Windows 7.  They should work on Windows 10 but currently, that is not tested.  If you wish any additional help, don't hesitate to ask!

Installation Steps - Preparation for Install

  1. Remove (uninstall) all old Java versions.  Also, delete folders containing old documentation, demos, and samples.  It can be difficult to delete old Java versions on Windows after you've installed a new version.  Oracle has an old version detection and removal tool (“uninstall tool”) you can use after you install a new version, from Java.com
  2. Create the folders C:\Java (which is where we will install the JDK), C:\Java\mylib (which is where we can put any needed Jar files that aren't already listed on CLASSPATH), and C:\Java\glassfish (which is where we will install the Wildfly or Glassfish Java EE server).  If you don't like the name mylib, pick another; I've also used MyExtensions and MyJars.
  3. Open a fresh DOS window, then run the command:
      C:\Temp>set >env.txt
    

    This makes a backup copy of all your environment variables, always a good idea before making changes that can prevent your system from working correctly.  Print out env.txt, just in case.

  4. An easier way to manage, view, save, and edit environment variables under Windows 7 is to install and then use the free tool Rapid Environment Editor.  (Windows 10 has an improved environment variable editor, so this tool isn't needed.  See helpdeskgeek.com for help on environment variables in Windows 10.)  Using that or the standard Windows environment variable editor, create or edit the following environment variables and set them to where you will install the software (change the values if you plan on installing in different locations):

    It is okay if your CLASSPATH setting has additional entries.  (The Apple QuickTime installer used to add one, but it isn't needed unless you want to use QuickTime from your Java applications.  Make sure you don't forget to include the leading period entry on CLASSPATH!

    In order to use the Derby (“Java DB”) database, these four files from the %DERBY_HOME%\lib folder must be listed on the CLASSPATH:
       derby.jar  derbyclient.jar  derbynet.jar  derbytools.jar
    

    While only two files are actually needed, the ones used would depend on the mode of your database (server or embedded).  Adding all four ensures you can use the Derby database in any mode, and the simple way to include these Jars is to list db\lib\* on CLASSPATH, as shown above.

    Add these entries to the PATH environment variable:

      C:\Java\bin
      C:\Java\ant\bin
      C:\Java\maven\bin
      C:\Java\db\bin
      C:\Java\glassfish\bin
      C:\Java\wildfly\bin
    

    (Using environment variables in PATH, such as “%JAVA_HOME%\bin” instead of “C:\Java\bin”, just won't work in most cases.)  The order these are listed in PATH shouldn't matter, but it might if your system uses an older java.exe often installed by default under C:\windows\System32\.  While the Java installer should remove that, sometimes it doesn't, so list your Java paths early on PATH, but after the one the installer puts in for the new JRE (see the box below for details).

    Note that the public JRE that was installed isn't listed above as something for you to add to the PATH.  Since Java 8, the installer adds the directory “C:\ProgramData\Oracle\Java\javapath” automatically.  That folder contains short-cuts to the public JRE's executables. 

    Note you may not even need the public JRE on PATH at all.  The reason is, the tools in the JAVA_HOME\bin folder are identical to the ones in the JRE's bin folder.  You don't need to list both locations unless you plan on installing multiple JREs.  That might happen if you need to test your code against multiple JREs, or if you leave the Java automatic updater turned on.  In that case, the public JRE you plan on using (C:\Program Files...\Java\jre8\bin) must precede the JDK's private JRE (C:\Java\bin) on PATH, or the public JRE won't be used.  In this case, remember there are configuration files in the JRE, so settings changed in one JRE won't affect other JREs.

    You can also just not install the public JRE when running the installer, but I don't recommend that.  Windows contains a registry setting used by some apps (some IDEs, web browsers, etc.) to find a JRE to use.  That is usually the public JRE installed last.  If you don't install the public JRE, that setting is unchanged and may point to an older version of Java, or a version that you've already deleted.  (This registry update is why it sometimes requires a reboot when updating Java, before the new version is used by all applications.)

    Make sure PATH doesn't already refer to any older JRE or JDK that might have been previously installed.  Note, some vendors pre-install a JRE in C:\windows (or some other location already listed on PATH).  If you think that is the case (that is, when you check the version used from the command line and it shows an old version), you should delete that old entry.

    Remember that both PATH and CLASSPATH are lists of folders (or, for CLASSPATH, folders, jar files, and zip files).  Each one is separated from the next with a semicolon (“;”) on Windows:

       FOO;BAR   — Good!
       FOO; BAR  — No good! (extra space)
       FOO:BAR   — No good! (wrong separator character for Windows)
    

    (Unix, Linux, and Mac OS use a colon (“:”) as a separator instead.)

  5. When updating the JDK, it goes in the same location as the previous version if you follow these guidelines.  However, the installer may not uninstall the previous version, leading to corruption if you later try to uninstall the older version.  (The most recent JDK install does offer to uninstall the previous version, but seems unreliable.)  So, as stated previously, it is best to uninstall any old JDK and JRE.  (The installer seems to handle multiple JREs better.  If you use the defaults for the JDK, a new directory is used for every version so you don't need to uninstall first.  But then you will need to update your environment variables and possibly reconfigure tools (such as IDEs) after each update.)  Don't forget to delete the folders you plan on replacing with new versions, including doc, samples, demos, etc.  Since these were simply extracted from a zip file, there is no uninstall option for them.

Download and Install Tools

With the environment all setup, it is time to install some tools.  Download the development tools and install in this order:

  1. JDK 8, 64-bit Windows version, for Java SE, the latest version.  (URL: http://www.oracle.com/technetwork/java/javase/downloads/)

    You can download JDK 9 instead, but many tools, and IDEs are not currently working well (or at all) with Java 9.  Some tools that require Java 8 installed include NetBeans and Glassfish.  If you cannot wait and insist on using Java 9 now, you can install Wildfly and not Glassfish, and not NetBeans.  Or, you can install both Java 8 and Java 9, and configure your tools accordingly.

    This installer includes several sub-installers.  The first one is for the JDK.  Change the install location for JDK to “C:\Java”, and later you can let the public JRE install where ever it wants, often in “C:\Program Files\java\jre version”.  Install everything.  (Java 8 Samples and demos are currently a separate zip download, and not installed with the main JDK installer.  However, samples and demos folders are deleted by the JDK installer for some reason.  So always install the JDK first, then all other stuff.  I strongly suggest downloading the documentation, to have an off-line copy always available.)

    When you use Java's automatic updater for Windows, third-party software may be included.  The two additional packages delivered to users in the past include the Ask Toolbar and the McAfee Security Scanner.  With Java updates (and sometimes, an install), you must specifically opt out of the additional software installations.  You may not want to use Ask.com, but apparently its installer delays its actions for 10 minutes or so.  So if you accidentally install it, you won't see the uninstall option show up in the control panel right away.

    The first screen-shots below are for JDK 8, but it should be similar for any JDK version.  Note the public JRE is left to install in its default location.  (Since the installer will adjust PATH for it, there's no reason to change the default anymore.)

    Screen-shot of first JDK install screen

    Screen-shot of first JDK 7 install screen after changing install location

    Screen-shot of JRE 7 install screen, showing defaults selected

    Shows JRE 7 install screen, with custom location for public JRE
    (Note the non-standard location, without version number details.)

    Install JDK on Mac OS X

    For Mac OS X, there may be a better/simpler way to install the JDK then the Java.com directions for installing Java on OS X.  This is because Apple no longer includes Java support, and the Oracle installer doesn't do all the setup required.  You can find help by searching the Internet; there are dozens of pages showing how-to setup Java on a Mac.  While untried by me, the simplest way may be this:

    1. Install Homebrew if you don't already have that: visit brew.sh, copy the long line shown, and paste it in a terminal window.  Doing this provides you with the brew command to install things.
    2. To update brew to know about the repositories for Java, run these commands from a terminal window:
      brew tap caskroom/cask
      brew install brew-cask
      
    3. Now run the command “brew cask install java”.

    After the installer finishes, you should launch the Java Control Panel and examine the settings.  (On Linux, the command to launch the OpenJDK control panel is “ControlPanel”.)  I generally turn off automatic JRE updates.  Next, add localhost to the exception site list (found in the “Web Settings” tab).  This is a list of sites from which you will allow downloaded unsigned or self-signed code (Applets or Web Start apps) to run.  You should add a couple of entries to enable running code from your local computer, and also from wpollock.com if you want to enable the demos from that website:

    http://localhost/
    http://127.0.0.1/
    https://localhost/
    https://127.0.0.1/
    file:///
    https://wpollock.com/   Add this only if you trust wpollock.com 
    

    Only the file:/// entry is needed unless you're running a server such as a web server, Tomcat, Glassfish, etc., and plan on serving up Java applets and/or WebStart applications.  In that case, you may need to specify a non-standard port number.  For example, by default the Glassfish server uses port 8080, so you need to add “http://localhost:8080/” and “https://localhost:8080/”.

    Note that IPv6 isn't currently supported by this exception list; also the JRE doesn't resolve name to IP addresses, so you need both the host name as well has the IP addresses added.  Also note you will get a warning with http: and file: protocols whenever you use them, since they are not secure; since you are using localhost it doesn't matter, so you should ignore those warnings.  It could be unsafe to use http:// for unsigned code from the Internet however.

    On the “Security” tab, make sure to enable Java content in the web browser, if you want to use Web Start Applications.  (Applets are not safe and deprecated, and likely to go away soon.)  You do not have to do this, as we won't be using Web Start in our course, but there are some WebStart demos on our class web page.  (If your browser isn't configured for Java, when you click a link for a JNLP file, you will prompted to pick a program to open the file with.  Browse to where you installed Java, and select javaws.exe.

    On the “Advanced” tab, I enable all debugging options, hide the Java console, disable mixed-code verification, enable TLS1.2 only (should be the default on new versions), and check the box to make the Java icon appear in the system tray (so I can click on it to show the console).

    Finally, you can copy some Jar files into the mylib folder from the JRE/lib folder, although it is easier to list them on CLASSPATH as shown.  (Indeed, you can list any Jars on CLASSPATH instead of copying them; this works best when you install in locations without version numbers.)  If you copy Jars, keep in mind you will need to update them when you update the originals, such as installing a new JDK or Glassfish version.

  2. The Oracle JDK no longer includes a database, so you will need to install one.  For classroom purposes, the Derby database from Apache is a good choice; it is also the database previously included in JDKs.

    Download and install the Apache Derby DB, latest official release zip.  (URL: db.apache.org/derby/derby_downloads.html.)  Unzip Derby and extract the one folder inside to C:\Java\.  Rename that folder to just “db”, to match the environment settings used earlier.

    (The database Jar files (there are several) need to be put on CLASSPATH in order to compile and run programs using that database.  This was done already, when you set CLASSPATH earlier.)

  3. Download and install Apache Ant, the “zip” archive of the latest version.  (URL: https://ant.apache.org/bindownload.cgi.)  The archive contains one folder, “apache-ant-version”.  Extract it to C:\Java, and rename the new folder to just “ant” (that matches the environment variable settings created earlier).
  4. Download and install Apache Maven, the binary “zip” archive of the latest version.  (URL: https://maven.apache.org/download.html.)  The archive contains one folder, “apache-maven-version”.  Extract it to C:\Java, and rename the new folder to just “maven” (that matches the environment variable settings created earlier).

    Install Maven on Mac OS X

    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.  But the simplest way seems to be this:

    1. Install Homebrew if you don't already have that: visit brew.sh, copy the long line shown, and paste it in a terminal window.  Doing this provides you with the brew command to install things.
    2. Run the command brew install maven.
    3. If your version of OS X doesn't include the tree command, you can install that since it is useful.  Use the command brew install tree.

    Not part of the setup, but a note is in order here:  If you install Java 9, Maven will not compile any code unless you change the pom.xml file for each project, to include these four lines in the appropriate place:

      <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 your code!)  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 Maven will address that problem!)

  5. Download and install JUnit 4, the latest version.  (URL: https://github.com/junit-team/junit/wiki/Download-and-Install.)  This site changed in 2013, and the new procedure is rather complicated.  From the download page, click the link for “junit.jar”.  You need to download the “jar” and the “javadoc.jar” for the latest version of JUnit 4 (currently, that is 4.12).  In my browser, that required a right-click and opening the link in a new tab.  Next, rename “javadoc.jar” to “javadoc.zip”.  Now you can easily open and extract the contents to a new folder; I used “C:\Java\JUnit-API”.  You can then set a bookmark (or favorite, depending on your browser of choice) to the index.html file in there, for quick off-line reference.  The downloaded “junit-version.jar” jar file should be put into C:\Java\mylib.

    You can optionally repeat these steps for the “hamcrest-core.jar” file and its javadoc.jar file.  (Hamcrest is an extension to JUnit 4.  I suggest extracting the documentation into “C:\Java\Hamcrest-API”.)

    You can also bookmark the online JUnit documentation, from https://github.com/junit-team/junit/wiki and http://junit.sourceforge.net/doc.  (This includes the JUnit Cookbook, and the combined JUnit and Hamcrest Java Docs (API).  Note the API documentation found here may not be as current as the versions you downloaded.)

    JUnit 5 was recently (as of 1/2018) released, and is a major rewrite of the whole system.  For now, our class will continue to use JUnit 4.  (This document will be updated for JUnit 5 in the future.)

  6. Download and install two JSON libraries used in our class.  Download the latest version of org-json.jar from Maven Central — search for org-json.  Also download the latest version of gson-version.jar from Maven Central — search for gson.  Put both Jar files into C:\Java\mylib.  (org.json is an older JSON library that is very simple to use.  Google's gson library is a powerful modern JSON library.)  You can also download the API docs for gson, as a Jar file.  Unzip it someplace to have a local copy of the docs; I used “C:\Java\GSON-API”.
  7. Java EE 8 is released, and while Glassfish 5 supports it, it will not (yet) run on Java 9!  If you cannot wait, you need to install Java 8 JRE.  (Note NetBeans 8.2 also needs Java 8 installed.)  It is likely that newer versions of software will be released that run on Java 9, but it takes time to produce such software and it just isn't available now.

    Instead, I suggest installing the Wildfly server.  It does run on Java 9, but it only supports the previous version of Java EE, version 7 (at least for now).  That should be more than enough for our class.  Wildfly is the popular, open-source Java EE platform formerly called the JBoss AS server.

    Install the Java EE server you selected.  Note!  You can skip this step and let NetBeans install Glassfish 4 for you, as shown below.  Otherwise, install Glassfish 5 as follows:

    To use the Glassfish 5 Java EE server instead of Wildfly, Make sure you have installed Java 8, then download the latest open source, multilingual, full platform version.  There are multiple versions, some from Oracle.  I installed the free, open source version from Oracle, which is named the “Java EE 8 Platform SDK”.  Download the zip (I used the “bundle” that included off-line versions of the documentation) from www.oracle.com/technetwork/java/javaee/downloads/.  (Or you can download the FOSS version (also as a ZIP archive) from https://javaee.github.io/glassfish/download.)  Install it as C:\Java\glassfish; the default is ...\glassfish5.

    This uses the username “admin”, with no password by default.  You can add a password for better security (and notadmin” or something equally easy to guess).  At HCC, no password was set.

    To use Wildfly instead of Glassfish, Download the latest ZIP using the link above, and extract the contents someplace.  I used “C:\Java\wildfly”, to match the environment variable settings used earlier.

    Next, download the Java EE API Jar file (“javaee-api-version.jar”) from mvnrepository.com/artifact/javax/javaee-api/.  Click on the latest version for the server you installed (“8.0” for Glassfish 5 or “7.0” for Wildfly ).  Near the top of the page is a link to the repository with the file, in this case probably “central”.  Click on that, then download the javaee-api-version.jar

    Copy the downloaded Jar file into C:\Java\mylib.  (This is needed only to compile Java EE code with javacIDEs download the correct client Jars when you create an appropriate Java EE project, as will Maven.)  (Optional: You can download the Java EE API docs as well from that same site, the file javaee-api-version-javadoc.jar.  Once the docs are downloaded, you can change the extension from jar to zip, extract the Java docs in a folder someplace such as “C:\Java\JavaEE-api”, and set a bookmark for the index.html file for off-line use.)

  8. EclipseLink, the latest version.  (URL: http://www.eclipse.org/eclipselink/)  Download the zip file, and extract the eclipselink folder to C:\Java\ (resulting in C:\Java\eclipselink).  (If you install elsewhere, remember to change the ECLIPSELINK_HOME environment variable.)  Complete the EclipseLink setup by copying the jlib\eclipselink.jar and the jlib\jpa\javax.persistence_version.jar files to mylib.  You can also extract the zipped documentation included, and make a bookmark in your favorite browser to that.

    (Note: You do not need javax.persistence_version.jar if you have javaee-api-version.jar on the classpath; both contain the javax.persistence.* classes required.)

  9. (Optional) Any hex editor, such as the free Neo from HHD Software, the latest version.  (URL: http://www.hhdsoftware.com/free-hex-editor.)  Run the installer, using the defaults for everything.
  10. (Optional, but strongly recommended) Stand-alone Git tools for Windows.  You might install Cygwin which installs a full POSIX and Linux-like set of tools, including a Bash command line, git, SSH, and many other tools, for Windows 7.  (For Windows 10, you can install Linux from the Windows store.)  Or you can install a GUI Git tool such as Tortoise Git.  The easiest solution may be to install Git for Windows, which includes both a limited Bash and command line utility set, just enough for working with Git, and a GUI as well.  (I often install both Git for Windows and Tortoise Git.)

    The Git for Windows installer offers several choices for various default settings.  You can certainly consider changing some of the defaults at this time, but do so only if you know the effects of your change.

    If you install both Cygwin and Git for Windows, both Git tools may end up listed on PATH.  You will probably need to adjust the PATH so all systems use a single git.exe.  Cygwin's Git tool also may cause problems with file endings, due to the configuration defaults.  If that happens, either adjust PATH to use the other git.exe, or change the core.autocrlf setting for Cygwin's git to true and see if that solves the problem.

    To complete your Git setup, you must configure some settings.  These may be stored in different locations; That means you should configure the Git settings for each IDE and any other Git installed (such as Git for Windows).  The settings include your real name, your email address, file encoding (“UTF-8” is recommended), line endings (see box above), and other settings you can configure to taste (such as not hiding the .git directory by default).

  11. (Optional) HashCalc, from www.slavasoft.com/hashcalc/.  This free program can calculate hash codes (also known as message digests or cryptographic checksums).  This is useful to verify the integrity of downloaded software, or to learn about hash codes such as MD5.
  12. (Optional) StarUML, from StarUML.io.  This UML diagramming and modeling tool is very popular and powerful.  While it has an unlimited free “trial” period, educational and other licenses are available.  (IDEs such as NetBeans and Eclipse have optional add-on software for working with UML; you might prefer those tools.)
  13. (Optional) VisualVM, from visualvm.github.io.  This free program can monitor running JVMs and provide lots of useful information.  Download the zip, and unpack someplace (“C:\Program Files\”), and add the bin subdirectory to PATH (“C:\Program Files\visualvm_14\bin”).

    The program may not find your JDK, and opens a useless console window.  To address that, create VisualVM.bat file with the contents:

    visualvm.exe --jdkhome "C:\Java" --console suppress
    

    (Be sure to create a short-cut to the .bat file and not the .exe file!)  The tool allows you to add plug-ins.  I added “VisualVM-Extensions”, “Threads Inspector”, and “Tracer-JVM Probes”.

  14. All the required software should now be installed, except for Eclipse and NetBeans.  (The installation of those tools is discussed next, as is the setup of the Glassfish server.)  To test all non-optional software installed so far, open a fresh command line window and run these commands:
       java -version
       javac -version
       ant -version
       mvn -version
       ij NUL
       sysinfo
       java org.junit.runner.JUnitCore
    

    You should not see any error messages.  The JUnit test should show 3-5 lines, starting with the version, and ending with “OK (0 tests)” (or some other number, depending on the version).

    Run the following only if you installed Glassfish:

       updatetool --version
       echo exit |asadmin
    

    The updatetool command will pop-up a GUI window showing a version.  The asadmin command line should show something similar to “Use "exit" to exit and "help" for online help.  Command multimode executed successfully.

    Run the following only if you installed Wildfly:

       standalone.bat
    

    This should produce some messages with the word INFO in them, but no error messages (if running Java 9, you will get many warning messages however).  You can test your server by opening a web browser to the default URL for Wildfly, http://localhost:8080/.  You should see the Wildfly welcome page.

    Type control+C in that DOS window to stop the server.

    To complete the Wildfly setup, click the link that appears “Administration Console”, and follow the steps shown to create an administrator user account.  (View a sample session of adding a Wildfly user.)

    You may get a message from your firewall software when running some of these tools and servers.  (Microsoft firewall may block some out-going connections.)  So you may need to enable Glassfish or Wildfly (and JRE) network connections.

    If you do get any errors, run the command “set” (or use the Rapid Environment Editor tool) and check the values of the environment variables very carefully!  On older versions of Windows, you may have to reboot after changing any environment variables, and not just open a fresh command line window, to have the changes take effect.

  15. Eclipse IDE for Java EE Developers, latest Windows 64-bit version.  (URL: http://www.eclipse.org/downloads/.)  The archive contains one folder, “eclipse”.  Extract it to “C:\Program Files”.  For convenience, you can make a short-cut to the eclipse.exe file within the newly installed folder, and put it on your desktop, quick-launch bar, or the Start menu.

    The Windows built-in zip support has a known problem with certain types of archives, such as very deep ones.  This results in a failure to completely extract the contents, without any indication of failure.  (The symptom is the following error dialog when trying to launch Eclipse:  “The Eclipse executable launcher was unable to locate its companion shared library.”)  The fix is to delete the damaged eclipse folder, and extract again using another tool such as 7zip, WinZip, or unzip.

    (Note, Eclipse may (but may not, depending on your installer) install a duplicate version of some utilities such as Ant and Glassfish4.  If you don't install the duplicate versions, the default project settings will be incorrect.  But if you do install them, they may not work under Java 9!  To use your already installed versions of Glassfish5/Wildfly, ant, JUnit, Maven, etc., you must change the Eclipse defaults to use the ones you installed separately.  Keep in mind that the versions of these tools may drift apart if you update one and Eclipse updates the other at different times.)

    Note!  Eclipse Oxygen 2 does not currently support Glassfish 5, only Glassfish 4 (and thus, Java EE 7 instead of 8).  No doubt, that will be fixed in the coming months.  Until then, don't bother allowing Eclipse to install Glassfish 4, and instead configure Eclipse to use Wildfly.

    Tip:  Eclipse can be installed on a Flash drive instead.  That way, you can carry around your development environment where ever you go.  (Make sure to also put your Eclipse “workspace” on the same Flash drive; see below for details on that.)

    Run Eclipse to make sure it works.  Make sure it can find your JDK (it will if you set the environment variables correctly).  When you first launch Eclipse, it will ask where to create a workspace, which is a folder that holds all your Eclipse projects.  I usually put that in my Java programs folder (see step 2 above), or in “My Documents”, and name the new folder “eclipse-workspace”.  I then check the box to use that as the default and never ask me again.

    Screen-shot of Eclipse screen to set a workspace

    Under the “Help” menu, run the “check for updates”.  You can also explore what add-ons (plugins) are available by clicking on the “Help→Install new Software...”, and install a few if you wish.  First, select “--All Available Sites--” from the drop-down list at the top.  Then check the boxes at the bottom to show only the latest versions, to contact all update sites during install, and to hide items already installed.  In particular, you should make sure the Git client is installed, from the “Collaboration” list:

    Screen-shot of Eclipse screen 1 to install add-ons

    Screen-shot of Eclipse screen 2 to install CVS and Git add-ons

    In Eclipse, you want the EGit add-on; the JGit add-on is a library that you can use in your Java programs to have them work with Git repositories.  JGit is actually used by EGit internally, and it will probably be installed as a dependency (depends on which version you use).  (In modern Eclipse versions, Git is likely installed by default.)

    If you get tired of having to right-click your project and choose Team to do anything, you should customize perspective, by enabling the Git command group, then adding the Git menu and/or the Git toolbar.  You can also go to “Windows→Show View→Other...” to add the Git Repositories view (I also like the Git Staging view, if your screen size is large enough).

    Try creating and running a “Hello, World” application, following the Eclipse docs for that.

    When done with the basic install (and you've read the basic Eclipse user manual!), you can “Install New Software...” to add some of Eclipse's optional features.  When done with that, explore the Eclipse Marketplace to find and install some very useful add-ons.  For example, I installed EclEmma code coverage tool (may be included by default in current versions), SpotBugs (formerly called FindBugs), and others.  (You find both of these commands under the Help menu.)  Do not go overboard and install too much at first; you can always install more later.

    To use Wildfly from Eclipse, you need to install “JBoss Tools” from the Eclipse marketplace.  (This is a huge plugin with many parts!)  Once that is done, go to the menu Window→Preferences→Server→Runtime Environment.  Click on the “Add...” button to add a new server.  Select your server (“Wildfly 11 runtime”), and click Next.  ... (This section to be completed.)

  16. NetBeans, the latest version for the Java EE bundle.  (URL: http://netbeans.org/downloads/.)  Unlike Eclipse, NetBeans has an installer. 

    Before installing NetBeans 8.2 (the current version), you must install a Java 8 JRE.  NetBeans will not run on Java 9, but it should be able to compile Java 9 code.

    Install NetBeans.  The screen-shots that follow show the installation main steps, including the installation of Glassfish and an extra copy of JUnit.  Don't re-install Glassfish if you did that already, or at least not to the same location.  Note, the bundled version is Glassfish4.  I suggest you do not bother to install that, and instead configure NetBeans projects to use Wildfly.

    Screen-shot of NetBeans install screen one

    Screen-shot of NetBeans install screen two

    Screen-shot of NetBeans install screen three

    Screen-shot of NetBeans install screen four

    (As with Eclipse, if you don't install the bundled copies of Glassfish4 and other tools, NetBeans won't know about your previously installed versions of those tools, until you update the defaults.  As with Eclipse, I recommend using Java 8 and the Wildfly Java EE server, version 10 (not “11”!), which should work well with NetBeans 8.2.)

    When done, launch NetBeans and run the menu item “Help→Check for Updates”.  After installing updates (and restarting NetBeans), you may need to update or install additional plugins.  To update or install plugins, use the “tools→Plugins” menu.  Make sure you install at least Git, if not installed by default (depends on the version of NetBeans you install).

    NetBeans now installs Git and some other versioning system clients by default, so they don't show as plugins.

    Try creating and running a “Hello, World” application.

  17. Before running Glassfish for the first time, run the GUI tool “updatetool.exe” tool (launch from the command line), and install all available updates.  You can also install additional add-ons if you wish.  Then test out Glassfish, by starting the default domain:
       asadmin start-domain
    

    This shouldn't show any error messages, except if Glassfish is already running when you use “start-domain”; that would be fine.

    Finally, open a web browser to the URLhttp://localhost:8080/”.  Explore the server a bit.  Notice you can run updatetool from there.  Click the link to go to the “Admin Console”, and explore that.  See if you can figure out how to download and install sample applications from there.

    When done exploring for now, you can shut down the Glassfish server with:

       asadmin stop-domain
    

Post-install Steps

To make development and testing more convenient, you can do some or all of these additional steps:

  1. Make a folder to hold your Java programs and projects.  At HCC, we use “C:\Temp”.  At home, I use “C:\%HOMEPATH%\Java”.  (On Windows 7, that becomes “C:\Users\wpollock\Java”.)
  2. Make a copy of the “command prompt” (cmd.exe) short-cut you can find in the Start menu.  Rename the copy to something like “Java CLI”.  Edit the properties of the new short-cut, to start in your Java folder (see the previous step).  You can also change the font and layout (number of rows and columns).  It is also handy to enable “Quick Edit Mode”.  This short-cut can be placed on the desktop, in the Start menu, or “pinned” to the taskbar.  (I put it in both the Start menu and taskbar.)
  3. Open the folder where you installed Eclipse, and right-click on eclipse.exe, and choose copy.  Then, you can “paste shortcut” in your Start menu, desktop, or the taskbar.  (NetBeans installs a desktop short-cut and a Start menu item, but you can still pin that to the taskbar if you wish.)
  4. You can add items to your right-click→send to menu.  I like to put a short-cut to Notepad (or your favorite text editor) there.  You can find the folder holding the items for this menu at “%APPDATA%\Microsoft\Windows\SendTo”.  (Notepad.exe is usually found in C:\Windows.  Right click it, copy, then open the “SendTo” folder, and paste as a short-cut.)

    If not using an IDE, a better editor than Notepad (in my opinion) is the free “Notepad++”.  (URL: http://notepad-plus-plus.org/download/.)

  5. If you turn off word-wrap in Notepad, you can enable the status bar, which shows the current line and column.  That is handy when you get an error message about line 234 (or whatever), and you can see what line that is.  (Also, control+G allows you to jump to any line.)
  6. Glassfish can be set to run as a Windows service, so it is always running.  Otherwise, you will need to start it running every time with “asadmin start-domain”.  If you don't want to be running this always, you can make it more convenient to start and stop a Java EE server using a short-cut.  You can make a pair of wscript files, one to start and one to stop Glassfish or Wildfly, that don't open console windows.  A good place for them might be “%GLASSFISH_HOME%\bin” or “%WILDFLY_HOME%\bin”, but if you do place them there and later update or reinstall your server, they may be gone!  Personally, I created a new folder called “C:\program Files\Utils” and listed folder that on PATH.  Then I put any scripts or other DOS software I download in there.  You can then add a short-cut to them from the Start menu, desktop, or taskbar.  (Feel free to ask me for my scripts.)

    Wildfly can also be run as a Windows Service.  See www.codinghowtos.com/install-wildfly-10-windows-service/ for directions.

  7. In your favorite web browser, you will want to make a bunch of favorites/ bookmarks to various Java-related documentation on the Internet.  Some of the ones I find most useful are:

    Java 8 API (http://download.oracle.com/javase/8/docs/api/)
    Java 8 SE docs (http://docs.oracle.com/javase/8/docs/)
    JUnit 4API (http://junit.sourceforge.net/javadoc/)
    Gson (Google JSON) docs: http://www.javadoc.io/doc/com.google.code.gson/gson
    Java EE API (https://javaee.github.io/javaee-spec/javadocs/)
    Your First Cup: An Introduction to the Java EE Platform, the Java EE tutorial, and other Java EE documentation (https://javaee.github.io/glassfish/documentation)
    Java EE HTTP application server (http://localhost:8080/)
    Java EE HTTPS application server (https://localhost:8181/)
    Glassfish Administration console (http://localhost:4848/)
    Wildfly Administration console (http://localhost:9990/console/)

    (Don't forget you can install local copies of most documentation, and set bookmarks to those, for off-line use.)

    Other bookmarks can be useful too, such as the one for the (older but useful) JUnit Cookbook, and documentation links for Ant, Maven, Derby, Git, and Glassfish.  Documentation often includes tutorials, quick-start guides, FAQs, and reference material.  Find and bookmark any you find useful.  (You can also download zip archives of the Java API docs for Java SE, JNLP (WebStart), JUnit, etc.  Then you can bookmark the local copies for use when you aren't connected to the Internet.  This can be useful to save data charges or when you have intermittent network access.  Don't forget to bookmark the locally installed JavaFx docs and all the demos and samples as well.  Explore the folders in JAVA_HOME to see what's available.)

  8. Open the Java control panel, and adjust any settings you don't like.  (My preferred settings were discussed above, in the JDK install step.)  From the “Security” tab, you can control if Java is enabled in web browsers (the few that still support plug-ins).  You may want that if you are using websites that still use Java Applets, or if you want to support java WebStart.

    (Note!  Most web browsers no longer support plug-ins such as Java.)

  9. To conveniently browse and launch WebStart applications that have been downloaded previously, make a short-cut in the Start menu for the WebStart downloaded applications: Locate ...\jre...\bin\javaws.exe, and add a short-cut from it to the Start menu.  (You can name the short-cut “Java WebStart”.)  Modify the short-cut properties by adding “ -viewer” to the end of the command line (“Target”).

    image of Java WebStart shortcut's properties

    That command launches the Java control panel's application (WebStart) cache.

  10. Customize the items on the Start Menu→Programs list.  I like to create a new folder in there called “Java”, and add short-cuts to all programs there (including some for Glassfish that don't get otherwise added anywhere in the Start Menu).