Wilson Mar bio photo

Wilson Mar


Calendar YouTube Github


Write once. Test everywhere.

US (English)   Norsk (Norwegian)   Español (Spanish)   Français (French)   Deutsch (German)   Italiano   Português   Estonian   اَلْعَرَبِيَّةُ (Egypt Arabic)   Napali   中文 (简体) Chinese (Simplified)   日本語 Japanese   한국어 Korean


This page takes you step-by-step to establish an environment to create your own “known good” rig.

We begin with a manual walkthrough, which we then automate.

Establish Environment

  1. Identify the platform you want to install Java into, which determines installation software:

    • local machine (laptop running macOS, Windows, Linux)
    • Docker image
    • Vagrant or VMWare image that includes an operating system

  2. If Docker or Vagrant, Download and install the virtualization utility on your laptop or a virtual instance.

    Within a new image or locally

  3. Run a script to download and install package manager for your operating system:

    • On Mac: Homebrew
    • On Windows: Chocolatey
    • On Ubuntu Linux: apt-get
    • On Red Hat: yum
    • etc.

  4. The choice of language (VM) support utilities you use and the license you want to pay are:

  5. Download and install language Static Code quality Analysis:

    • clone the https://github.com/teamed/qulice, the maven plug-in to your local machine, then add in the pom.xml of the project the xml shown at http://www.qulice.com/.

    Clone GitHub

  6. Use Git to clone to your local laptop the repository containing source program code:

    • http://github.com/wilsonmar/java-sample-code.git based on code at http://www2.cs.uic.edu/~sloan/CLASSES/java/ by https://acm.cs.uic.edu/ (University of Illinois at Chicago)

    • https://www.reddit.com/r/programmingbydoing/ from Graham “holyteach” Mitchell are assignments (challenges) but no answers.

    PROTIP: We would like example code scanned by static code analyzers so they’re good examples of coding technique.

    PROTIP: Run the simplest of Java code in order to verify the environment and various libraries, such as after a new version in one of them. This is so if “known-good” code don’t work, then the issue is NOT the custom application code which the programmer has control.

    By process of elimination, the problem lies in the setup items above.

    Utility class libraries

    (from 3rd parties) which custom Java program code specify for import

  7. Google Guava is an open source, Java based library developed by Google (and not those outside) It’s supposed to facilitate best coding practices and helps reduce coding errors.

    • https://github.com/google/guava
    • https://en.wikipedia.org/wiki/Google_Guava
    • http://www.tutorialspoint.com/guava/

    It provides utility methods that makes use of functional programming for:

    • string processing
    • primitives support
    • I/O
    • validations
    • collections
    • caching
    • concurrency
    • common annotations

  8. Logging framework

    • Log4J
  9. Metric extraction framework

    • ElasticCache
    • Prometheus (open source)

Compile OK?

By “known good” we mean more than what is needed to compile:

  • The java code file has an extension .java.

5. Open a Terminal shell (on the Mac) or Run a Command window (on Windows), and navigate to where the GitHub folder to compile a program:

   javac HelloWorld.java

NOTE: Case is sensitive here, so you’ll have to press Shift key for those upper case letters.

NOTE: Compilation means taking the source code in the file HelloWorld.java and creating a file named “HelloWorld.class” containing Java ByteCode (classes, thus the name).

If there are errors, then troubleshoot the Java setup.

There is a HelloWorld1.java file. The name of the class inside the file is NOT the same as the name of the .java file, this appears:

   HelloWorld1.java:1: error: class HelloWorld is public, should be declared in a file named HelloWorld.java
public class HelloWorld {
1 error

6. Run the compiled program use the command java as in:

   java HelloWorld

The file extension “.class” is not specified in this command.

PROTIP: The .gitignore file specifies that no .class files be sent back up to GitHub because each environment compiles its own.

The response should be a single line on the terminal:

   Hello World!

Just for laughs, use your IDE/text editor to view the .java source code to see the coding which produced the output.

Manual Compile

7. In a terminal (or in Jenkins), manually run the shell script which compiles and runs all the samples.

   chmon a+x javac_all.sh

.gitignore file

9. Use a text editor to review the .gitignore file.

The .gitignore file among the files specify what should not be sent back up to the repository.

The .project folder is ???

Notice the target folder which Maven sends its output is not uploaded back to GitHub.

Alternately (less popular and easy to forget approach) remove the .class files created above by manual run of javac:

   rm -rf *.class

Instead we’ll be using Maven to run the compiler.

Install Maven

10. Download build utility Maven. For Mac OSX:

   brew install maven

Maven looks at the root of the folder for a pom.xml (Project Object Model) to process. Thus, the pom.xml in the sample folder begins and ends with <project> tags.

See http://maven.apache.org/guides/introduction/introduction-to-the-pom.html

11. Run the minimal pom.xml file.

   mvn clean

The first time this runs, several Maven modules are downloaded automatically under the home folder of the logged in user, such as:


For example, under the org folder are apache, codehaus, and sonatype.

Sonartype is the publisher of Nexus cloud-based repository.

  • https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8.ReleaseIt
  • http://www.sonatype.com/books/nexus-book/reference/staging-sect-managing-plugin.html

Alternately, there is Artifactory.com.

An example of a response:

   [INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.490 s
[INFO] Finished at: 2016-03-29T13:10:24-06:00
[INFO] Final Memory: 12M/245M
[INFO] ------------------------------------------------------------------------

Build with Maven

12. Add additional goal to instrument.

The “clean” after mvn command specifies one of the “goals” specified in the pom.xml.

Other typical <goal> entries:

  • clean
  • compile
  • package
  • install (locally)
  • deploy (to a remote location)

It specifies the Qulice Maven plug-in, which contains several checkers http://www.qulice.com/index.html

http://www.qulice.com/quality.html provides links to the quality rules used by checkers packaged into Qulice.

<goal>instrument</goal> in the pom.xml file invokes Cobertura, which complains when test coverage is not sufficient.

mvn clean instrument

NOTE: The mvn program can accept several goals in one command.

13. Defaults can be overridden by <build> entries in pom.xml.

Jar files names ending in “SNAPSHOT” are not meant for public release.

14. Add files containing userids and passwords used in deploy to a corporate repository.

To deploy to remote locations, additional files are needed to specify user ids and passwords.

“settings.xml”, “pubring.gpg”, and “secring.gpg” files are copied in for security reasons, files containing secruity credentials are not part of the repository on GitHub.

This specifies the settings file as input into the deploy goal.

mvn clean deploy -e -Dci --settings ../../closures/settings.xml


15. Verify the pom.xml file and establish work folders Maven needs:

   mvn clean

The first time this runs, several Maven modules are downloaded automatically.

The ending lines:

   [INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.490 s
[INFO] Finished at: 2016-03-29T13:10:24-06:00
[INFO] Final Memory: 12M/245M
[INFO] ------------------------------------------------------------------------

Test Harness

16. Rather than downloading the test harness and other utilities, Maven can download a specific version:

This is especially for negative test programs.

Static Scan

17. The pom.xml also specifies download of Static Code Analyzers used to establish “known good” status.

These sample programs are run using a task runner.

Examples of analyzers and what they are looking for:

  • http://www.qulice.com/quality.html

18. Run the file:

   mvn compile

19. Build the .jar package in the target folder:

   mvn package

The .jar package is really a .zip file containing one or more class files.

Task Runner

20. Download and install a local task runner service:

It’s 2016, so this is really not optional for professional programmers.

  • Jenkins locally.

  • Jenkins in the cloud by Cloudbees or Circle-CI.

  • An alternative is Gradle, what Google uses for Java Android development locally on a laptop.


This page contains an example of how to incorporate Gists (from GitHub) in Jekyll Markdown.


  • http://docs.oracle.com/javase/8/ Java Platform, Standard Edition (Java SE) 8

  • http://docs.oracle.com/javase/tutorial/

  • http://introcs.cs.princeton.edu/java/11cheatsheet/

  • http://java.worldbestlearningcenter.com

  • http://www.cs.armstrong.edu/liang/intro9e/exercisesolution.html

More on DevOps

This is one of a series on DevOps:

  1. DevOps_2.0
  2. ci-cd (Continuous Integration and Continuous Delivery)
  3. User Stories for DevOps
  4. Enterprise Software)

  5. Git and GitHub vs File Archival
  6. Git Commands and Statuses
  7. Git Commit, Tag, Push
  8. Git Utilities
  9. Data Security GitHub
  10. GitHub API
  11. TFS vs. GitHub

  12. Choices for DevOps Technologies
  13. Pulumi Infrastructure as Code (IaC)
  14. Java DevOps Workflow
  15. Okta for SSO & MFA

  16. AWS DevOps (CodeCommit, CodePipeline, CodeDeploy)
  17. AWS server deployment options
  18. AWS Load Balancers

  19. Cloud services comparisons (across vendors)
  20. Cloud regions (across vendors)
  21. AWS Virtual Private Cloud

  22. Azure Cloud Onramp (Subscriptions, Portal GUI, CLI)
  23. Azure Certifications
  24. Azure Cloud

  25. Azure Cloud Powershell
  26. Bash Windows using Microsoft’s WSL (Windows Subsystem for Linux)
  27. Azure KSQL (Kusto Query Language) for Azure Monitor, etc.

  28. Azure Networking
  29. Azure Storage
  30. Azure Compute
  31. Azure Monitoring

  32. Digital Ocean
  33. Cloud Foundry

  34. Packer automation to build Vagrant images
  35. Terraform multi-cloud provisioning automation
  36. Hashicorp Vault and Consul to generate and hold secrets

  37. Powershell Ecosystem
  38. Powershell on MacOS
  39. Powershell Desired System Configuration

  40. Jenkins Server Setup
  41. Jenkins Plug-ins
  42. Jenkins Freestyle jobs
  43. Jenkins2 Pipeline jobs using Groovy code in Jenkinsfile

  44. Docker (Glossary, Ecosystem, Certification)
  45. Make Makefile for Docker
  46. Docker Setup and run Bash shell script
  47. Bash coding
  48. Docker Setup
  49. Dockerize apps
  50. Docker Registry

  51. Maven on MacOSX

  52. Ansible
  53. Kubernetes Operators
  54. OPA (Open Policy Agent) in Rego language

  55. MySQL Setup

  56. Threat Modeling
  57. SonarQube & SonarSource static code scan

  58. API Management Microsoft
  59. API Management Amazon

  60. Scenarios for load
  61. Chaos Engineering