Java Development Environment
Effective development in Java within a team context requires that all developers are equiped with the same tools to perform the tasks at hand. This guide deals with setting up a development environment for Java and Spring development.
2. Environment variables
As Java and tools are often executed from the command line it is important to ensure that these tools are properly registered using environment variables and added to the path statement.
Setup the following environment variables;
JAVA_HOME = <PATH TO JAVA INSTALL DIR>
MVN_HOME = <PATH TO MAVAN INSTALL DIR>
MAVEN_OPTS = -Xms1024m -Xmx4096m (1)
| 1 | This increases the memory available to Maven |
| These environment variables, such as JAVA_HOME and MVN_HOME, should point to the root directory, not the /bin directory in each. |
These new variables can then be added to the path statement, which will ensure those commands can be executed from the command line.
PATH = <EXISTING PATH DEFINITION>; %JAVA_HOME%\bin; %MVN_HOME%\bin
| The \bin directory should be appended to the environment variable. |
| Ensure that any other Java install directories are removed from the path. |
3. Testing your installation
Test your installation for proper operation with the following commands;
$ java -version
$ mvn -v
$ git --version
In each case the command should output the product’s version information.
4. Configure git
Setup your git installation by supplying your name, email address and, a requirement for Windows installations, the line feed / carriage return setting;
$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]
$ git config --global core.autocrlf true (1)
| 1 | Only Windows users are required to set the autocrlf property!! |
Run the following command to confirm these settings have been applied;
$ git config --list