How Do You Create a Chef Recipe to Install Java on Linux Chef-Client Nodes?

Problem scenario
You have Linux servers that need Java 1.8 installed on them.  How do you write a Chef recipe to deploy Java?

Solution
Prerequisite
This solution requires that the Chef server must have access to GitHub.  If you want to install Chef server, see this posting.  If you want to install Chef client, see this posting

How Do You Install Maven, openjdk, libssl-dev, build-essential, and pkgconf on a RedHat 7.X or CentOS 6.X Linux Server?

Problem scenario
You are using a RedHat derivative distribution of Linux (e.g., CentOS/RHEL/Fedora).  To eliminate a Hadoop error, you need to install a variety of packages.  How do you install Maven, openjdk, libssl-Dev, build-Essential, and pkgconf?

Solution
To install Maven, see this article.

For the rest of the packages, run these commands:

sudo yum -y install java-1.8.0-openjdk-devel openssl-devel cmake protobuf

sudo yum -y groupinstall ‘Development Tools’

curl ftp://rpmfind.net/linux/fedora/linux/updates/25/x86_64/p/pkgconf-1.3.7-1.fc25.x86_64.rpm pkgconf-1.3.7-1.fc25.x86_64.rpm

curl ftp://rpmfind.net/linux/fedora/linux/updates/25/x86_64/l/libpkgconf-1.3.7-1.fc25.x86_64.rpm libpkgconf-1.3.7-1.fc25.x86_64.rpm

sudo rpm -ivh *.rpm …

How Do You Troubleshoot the Java Error “java.lang.Error: Properties init: Could not determine current working directory”?

Problem scenario
You run this command:
javac -version

But you receive this error:  “Error occurred during initialization of VM java.lang.Error: Properties init: Could not determine current working directory.”

How do you solve this problem?

Solution
Log out of Linux and log back in.

How Do You Troubleshoot the Java Error “class … is public, should be declared in a file named foobar.java”?

Problem scenario
You copied a Java program from the Internet.  You named the file foobar.java.  You try to compile it (e.g., with “javac foobar.java”), but you get this error:

foobar.java:6: error: class ContInt is public, should be declared in a file named ContInt.java
public class ContInt
       ^
1 error

What do you do?

Solution
Rename foobar.java to be ContInt.java.

How Do You Install Java on an AWS Instance of RHEL?

Problem scenario
You are using RedHat Enterprise Linux 7.x in AWS.  How do you install Java?

Possible Solution #1
Use this posting as it is preferred. Below is an alternative.

Possible Solution #2
This will install Java 1.8.x.

1. Create a file named java.sh with this as the content:

yum -y install java-1.8.0-openjdk*
JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
echo ‘export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk’ ~/.bashrc
source ~/.bashrc
sudo -s
sudo -s source /etc/environment

2.  

How Do You Troubleshoot This Error “javac: command not found”?

Problem scenario
You have Java installed. The “java -version” command returns data showing that Java was been installed correctly.  You try to use the javac command to compile a .java file.  You get this error:

-bash: javac: command not found

How do you compile your Java code when javac is not recognized?

Solution
As root,

How do you install Hadoop on Linux SUSE?

Updated on 1/1/18
You may want to see this different posting that works for Linux SUSE as well as other non-SUSE distributions of Linux.

Problem scenario
You want to install the open source version of Hadoop 3.0.0 on Linux SUSE 12 SP3.  What do you do?

Solution
These directions would work on a non-SUSE distribution if you install Java a different way from the first command in the script. 

Definition of a Java Thread

Java source code is compiled into bytecode.  Bytecode, when run, is executed by the processor.  Sequences of bytecode go through processors, and on occasion these sequences must be analyzed for developing new Java software.  Java Enterprise Edition (the programming language of choice for many businesses) is owned by Oracle.  However, Oracle is not always the best creator or custodian of documentation for Java.  Here is an example (as of November 2015) taken from Oracle’s