This article will walk you through the process of compiling Java and JavaFX applications into native binaries using GraalVM and Gluon. This version is initially focused on MacOS, but will be updated for Windows.
Installing GraalVM GraalVM is a software package that includes a Java SDK and tools for converting Java programs into native applications. I recommend you to use this SDK during your development. Let’s start by downloading GraalVM. The available Java version as of the publication of this page is 22.
FreeBSD is a powerful and reliable operating system that is widely used by developers and system administrators. If you are a Java developer, you will need to install both Java and Maven on your FreeBSD system to build and run your Java applications. In this post, we will walk you through the steps to install Java and Maven on FreeBSD.
Java We will start by switching to the root account, and installing java.
The following examples use random generated numbers initialized with a static seed. Never do it like this.
Run the following examples multiple times to understand why it is important to have a good seed.
PHP version:
#!/usr/bin/php <?php srand(2); echo rand(0,10)."\n"; echo rand(0,5)."\n"; echo rand(0,4)."\n"; echo rand(0,6)."\n"; Java version:
import java.util.*; /** * @see https://docs.oracle.com/javase/7/docs/api/java/util/Random.html */ public class RandomDemo { public static void main( String args[] ){ Random r = new Random(2); System.
This article lists a curated list of Java libraries that I have used over the years for different projects. They are all well documented, and for most of them, plenty of examples can be found on the web.
Apache Commons Email Commons Email
Commons Email aims to provide a API for sending email. It is built on top of the Java Mail API, which it aims to simplify.
User Guide Apache Commons StringUtils <dependency> <groupId>org.
So far I have really liked this concept. The only con is that some times is difficult to find full examples that use the latest version.
Installing sbt We need sbt for compiling and running Play applications.
brew install sbt@1 Executing a first application Check the tutorials page to see how to create a first project.
Pretty much:
sbt new playframework/play-java-seed.g8 sbt run And then visit localhost:9000
Play 2.
From time to time it is necessary to execute a query without using Java’s JPA infrastructure.
In order to do it, we have to define a NamedQuery to execute. In this example, I will run an update against the database.
@Entity @NamedQueries ({ @NamedQuery ( name = "SomeEntity.TestQuery", query = "update SomeEntity se set se.myField = '' where se.id = 0" ) }) public class SomeEntity implements Serializable { // .
Today I bring an example of the different results you can expect when using Java’s BigDecimal class. From instantiation to applying different arithmetic operations, it is important to understand how they affect the resulting instances.
The following program shows different scenarios and results applied to BigDecimal’s.
package test; import java.math.BigDecimal; import java.math.RoundingMode; public class Test { public static void main(String[] args) { BigDecimal a = new BigDecimal("1.204165"); System.out.println("a (from string): " + a); // 1.
This Java example finds all the tables and their corresponding columns from a database. The code iterates over the entities and columns found and shows them on the console.
Minor changes are necessary to process the found values in a different way.
Connection conn; DatabaseMetaData dmd; ResultSet rs1, rs2; ResultSetMetaData rsmd; Statement s; try { conn = getConnection(); dmd = conn.getMetaData(); rs1 = dmd.getTables("database_name", null, "%", null); s = conn.createStatement(); while (rs1.
Netbeans is one of my beloved day to day applications. Yesterday, when I installed Ubuntu 15.10 (Wily Werewolf) on my computer, Netbeans started to hang on the startup screen, specifically at the Loading Modules phase. It took me hours looking for solutions on the internet; and reinstalling different versions of the Java Development Framework didn’t seem to help.
Finally I found the following fix at an Ubuntu forum, which turned out to be very simple to apply.
Important: This is a work in progress document.
The Model-View-Controller is a software pattern frequently used for web development. As its name states, it is composed by three components:
A Model or domain representation of a problem. It receives commands, processes them and modifies its state according to the input provided. A View whose main task is to retrieve information from the model and turn it into a useful representation for the user.