Java
NOT PORTED YET.
- Books
- SDKman - Install and Manage Multiple Versions of Java at the same time
- Show Java Classpath
- Inspect JAR contents
- JKS - Java Key Store (SSL)
- Java Decompilers
- Libraries
- JitPack.io
- JShell
- JBang
- JBang CLI
- GraalJS
- Clojure
- ProGuard
- ProGuard Core
- ProGuard Assembler / Disassembler
- Kotlin Metadata Printer
- ProGuard iXGuard
- JVM Distributions
- Corretto
- Gluon
- GraalVM
- Java.net
- JetBrains
- Liberica
- Mandrel
- Microsoft
- Oracle
- SapMachine
- Semeru
- Temurin
- Tencent
- Zulu
- Memes
- Books That Made You Cry
- Porting Your Language to the JVM
- Imported Package Tariffs
- Santa, Want Dragon
- Balancing Dog
Books
SDKman - Install and Manage Multiple Versions of Java at the same time
See SDKman page.
Show Java Classpath
Since the java -cp / java -classpath is one huge string of colon separated paths, it's nicer to show them one
per line using the scripts in DevOps-Bash-tools or DevOps-Perl-tools
repos:
Crude shell pipeline to do similar:
grep java |
tee /dev/stderr |
awk '{print $2}' |
xargs -L1 jinfo |
grep java.class.path |
tr ':' '\n'
although if it's just jinfo you're missing in the $PATH it would be better to just:
Inspect JAR contents
Java jar files are just tars of the byte-compiled Java classes.
You can inspect them using the good old unix tar command, eg.:
or
The directory layout of the class files corresponds to the class hierarchy eg.
is accessed as com.mysql.jdbc.Driver in Java code.
JKS - Java Key Store (SSL)
See SSL doc.
Java Decompilers
Use these to decompile JAR or .class files to read the Java source code.
Using DevOps-Bash-tools repo:
For a GUI:
or
For command line output:
or
Libraries
Some libraries of interest:
- Faker - generates fake but realistic data for unit testing
JitPack.io
Package repo for JVM and Android projects.
Builds Git projects on demand and provides ready-to-use artifacts (jar, aar).
To check if a Jitpack dependency target is valid:
VERSION="v1.0.0"
For an Android dependency, check for the .aar artifact instead of .jar
Check build log to show what was built by JitPack:
JShell
Command line or interactive Java Shell.
Java 9+:
| Welcome to JShell -- Version 21.0.4
| For an introduction type: /help intro
jshell>
See also Groovy which is one of my favourite languages and has a shell:
JBang
Packages executable self-contained source-only Java programs.
Install using SDKman:
Create a source code CLI program:
Reading the source code it shebangs jbang and annotates the class with some metadata for jbang.
The first run downloads the dependencies mentioned in the source code
[jbang] Resolving dependencies...
[jbang] info.picocli:picocli:4.6.3
[jbang] Dependencies resolved
[jbang] Building jar for hellocli.java...
Usage: hellocli [-hV] <greeting>
hellocli made with jbang
<greeting> The greeting to print
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Hello JBANG!
Automatic fetches any dependencies referenced in the source code using //DEPS group:artifact:version comments
or @Grab annotations.
Even downloads a JDK if needed.
This makes portable Java scripting easier.
JBang CLI
Example of JBang CLI using Faker library to output random names:
import com.github.javafaker.Faker
Faker faker = new Faker()
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS com.github.javafaker:javafaker:1.0.2
import com.github.javafaker.Faker;
import java.util.stream.Stream;
public class faker {
public static void main(String[] args) {
Faker faker = new Faker();
Stream.generate(faker.name()::fullName)
.filter(s -> s.contains("Hari"))
.forEach(s -> System.out.println(s + " is Awesome"));
}
}
EOF
See also Groovy which is one of my favourite languages and wish I had more excuses to code it in other than:
GraalJS
JavaScript engine running on JVM via GraalVM.
ECMAScript-compliant runtime to execute JavaScript and Node.js applications on JVM with benefits of GraalVM stack including interoperability with Java.
Clojure
Just a jar, no dependency like Scala predef.
ProGuard
ProGuard Core
https://www.guardsquare.com/proguard
https://www.guardsquare.com/manual/home
https://playground.proguard.com/
Shrinker, optimizer, and obfuscator for Java and Kotlin code.
ProGuard Assembler / Disassembler
GuardSquare/proguard-assembler
Kotlin Metadata Printer
GuardSquare/kotlin-metadata-printer
ProGuard iXGuard
https://www.guardsquare.com/ixguard
Obfuscates iOS code. See iXGuard page.
JVM Distributions
These are the options you'll see when you install SDKman and sdk list java.
Temurin is the default open source distribution that SDKman uses.
Corretto
Amazon's OpenJDK distribution with long-term support and performance enhancements.
https://aws.amazon.com/corretto/
Gluon
Mobile-focused OpenJDK distribution optimized for JavaFX applications.
https://gluonhq.com/products/mobile/
GraalVM
High-performance JDK with ahead-of-time compilation and polyglot capabilities.
Java.net
Official OpenJDK reference builds provided by Oracle.
JetBrains
Custom JDK distribution optimized for JetBrains IDEs.
Liberica
Full OpenJDK distribution with JavaFX support from BellSoft.
Mandrel
GraalVM-based JDK optimized for Quarkus applications.
Microsoft
Microsoft's OpenJDK distribution with enterprise support.
https://learn.microsoft.com/en-us/java/openjdk/
Oracle
Official Oracle JDK with commercial support and licensing requirements.
https://www.oracle.com/java/technologies/downloads/
SapMachine
SAP's OpenJDK distribution optimized for SAP workloads.
https://sap.github.io/SapMachine/
Semeru
IBM's OpenJDK distribution with Eclipse OpenJ9 for performance optimizations.
https://developer.ibm.com/languages/java/semeru-runtimes/
Temurin
Community-driven OpenJDK distribution maintained by Adoptium.
Tencent
Tencent's OpenJDK distribution optimized for cloud environments.
Zulu
Azul's OpenJDK distribution with commercial support and JavaFX options.
https://www.azul.com/downloads/zulu/
Memes
Books That Made You Cry
Porting Your Language to the JVM
Imported Package Tariffs
Santa, Want Dragon
Balancing Dog
Ported from various private Knowledge Base pages 2010+