Java Programming Language

#programming-language, java, jvm

Notes about the Java programming language and ecosystem surrounding it.

Why Java

Tricks

maven quickstart

mvn archetype:generate -DgroupId=com.btbytes -DartifactId=projectname -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

to launch a java compiled .class quickly

  1. Set alias jn="java -Xms32m -Xmx32m -client -noverify"
  2. Run the java class thus: jn -cp . HelloWorld
  3. The execution time feels fast enough like a Python program.

Also see – Nailgun: Insanely Fast Java

Nailgun is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead. Programs run in the server (which is implemented in Java), and are triggered by the client (written in C), which handles all I/O.

Using Java as a “scripting language”

JGrab - run Java code fast, from source, with a little Rust help - Renato Athaydes

// #jgrab com.google.guava:guava:19.0

 import com.google.common.collect.ImmutableMap;
 import java.util.Map;

 public class UsesGuava {

     public static void main(String[] args) {

         Map<String, Integer> items = ImmutableMap.of("coin", 3, "glass", 4, "pencil", 1);

         items.entrySet()
                 .stream()
                 .forEach(System.out::println);
     }
 }
jgrab UsesGuava.java

Also see lkesteloot/java_launcher: Helper script to treat Java programs as scripts. by Lawrence Kesteloot

Also see: Blaze.

Blogs

Java 9

A minimal JRE with just the base module is 15MB on linux-amd64; for reference, the JDK 8 JRE is 165MB.

Modern Java

Javascript

New features

Blog posts

Exceptions

Memory

Streams

JIT Optimisation

JVM

Libraries

Functional programming

Database

Distributed

Web Frameworks

Command line / app delivery / scripting

Build systems

Containers / packaging

Talks

References
Grab Missing citation
CodeFX Missing citation