application

Scala/SBT: How to deploy a single, executable Jar file

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.14, “How to Deploy a Single, Executable JAR File.”

Problem

You’re building a Scala application, such as a Swing application, and want to deploy a single, executable JAR file to your users.

How to build a macOS application from a Java Jar file

Table of Contents1 - Background2 - Requirements3 - Building your application4 - Note 1: Font smoothing5 - Note 2: Setting the “application category”6 - The Mac/Java AppBundler7 - More information8 - Summary

In this article I’ll show how to build a macOS application from a Java Jar file. I tested this with Java 1.8 on macOS 10.12.5 (Sierra) on June 29, 2017.

Three assumptions in this process are:

An RSS Reader written with Scala and JavaFX (the beginning) alvin September 17, 2016 - 6:23pm

I just started writing an RSS Reader application using JavaFX and Scala, and I thought I’d post the initial code here. This code shows several advanced Scala techniques that Scala developers might need to use when writing Scala code to interact with Java, and in this case, JavaFX.

A custom JavaFX web browser (to show stock quotes)

I’m currently doing something completely different, and writing a little custom web browser using JavaFX and its WebView component. I’m using it so I can easily look at stock quotes and charts. I just started on it, and the current UI looks like this:

A custom JavaFX WebView web browser

Scrivener, an app for writers

In some ways Scrivener is a bit of a klunky, older-looking Mac OS X application, but I started using it two days ago, and it has helped me organize my ideas, so for that I give it credit. It’s intended to be used by writers who want to write books, and as I said, it does help with the organization aspect, and that is helpful. It’s better than a pile of files in a directory that you manually try to keep in order, that’s for sure.

How to launch a Scala application with an object (main, app)

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 6.4, “How to launch a Scala application with an object.”

Problem

You want to start an application with a main method, or provide the entry point for a script.

Solution

There are two ways to create a launching point for your application: define an object that extends the App trait, or define an object with a properly defined main method.

Applications I’ve written

This is a list of some of the applications I (Alvin Alexander) have written. I’ve included links to places where you can find more information about each app or application.

Just Be

Just Be is a mindfulness reminder application for Android. Being an Android app, I wrote it in Java. You can learn more about it at JustBe.cc.

Android/Java: How to get your app's root data directory

If you ever need to get the root data directory of your Android application (app) from within your Java code, I can confirm that this approach works:

File rootDataDir = getActivity().getFilesDir();

When I log that directory like this:

Log.i(TAG, rootDataDir.toString());

it prints this output for my application:

/data/data/com.alvinalexander.mynewapp/files

where com.alvinalexander.mynewapp is the package name for my new Android app.