💡Tips / FAQ
Design Goals
Ease of use: The classes and methods must be flexible and simple to use.
No UI calls: Do everything without user interface to allow this toolkit to be used for background tasks or server processes.
Fast: Write the code as performant as possible.
Favor memory usage over I/O: In today's world, memory is no longer a limiting factor. Therefore, many operations can be done in memory where (temporary) files were used in the past (e.g. KDB creates a data structure from SQL SELECT, KFile operations are mostly in memory).
Use extensive logging: The KLog.debug() and KLog.error() functions are used throughout the code to help debugging your code. Also use the toString() methods found in each class to show the internal field values of the objects during development.
Platform independence: Write everything platform independent.
Minimize prerequisites: Stay with the Java SE standard libraries. Use only external JAR files when absolutely necessary (e.g. KSMTPMailer, JDBC drivers).
GraalVM Native Image Support
The Java Utility Package supports the creation of GraalVM native executables by including the necessary Java reflection definitions within the JAR file.
Prerequisites
macOS: Xcode
Windows: Visual Studio Build Tools 2022 or later
Compile / Create Executable / Run (macOS)
JShell
For a quick test of any ch.k43.util function, utilize the interactive JShell command included in the JDK. Ensure the ch.k43.util JAR file is either located in the current directory or accessible via the directory specified in the class-path argument.
See the Java Shell User Guide on how to use JShell
Java Stores
There are two keystore files used in Java:
Key Store: These files contain certificates to proof authentication with a private key. Certificates can be server certificates (e.g. www.acme.com), intermediate certificates or client certificates (e.g. john.doe@acme.com).
Trust Store: These files contain public certificates of trusted identities. Certificates are trusted root certificates (e.g. Verisign, Microsoft, etc.), intermediates certificates or trusted server and client certificates. A default file (usually named cacerts with the default password changeit) is shipped with the JVM.
Create Self Signed Certificate
Convert PEM certificate to P12
Create JKS file from P12 certificate
Add Client Certificate to JKS file
Display Content of JKS file
Simple TLS Server
TLS Connection Test
Last updated