property

How to get Java/Scala system environment variables and properties

Want to get the system environment variables and/or properties from your Scala or Java application? This quick post shows what environment variables and properties are available.

Here’s a little Scala application that prints all the environment variables and properties. You’ll see that you can convert it to Java very easily:

Scala: Reassignable variables and properties (def fields)

Sadly, I had to get away from Scala for a while, but now I can get back to it again. Just as I started getting back into it I happened upon the following code, and thought, “Well, surely title in this anonymous class is a var field. How strange that the Programming in Scala guys would use a var like this.”:

Scala: How to define properties in an abstract base class or trait

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 4.13, “How to define properties in an abstract base class or trait.”

Problem

You want to define abstract or concrete properties in an abstract base class (or trait) that can be referenced in all child classes.

Scala SBT - How to force/require a specific SBT version

I ran across this code snippet in the SBT docs, and thought it was a good but hard to find tip. To force/require a specific SBT version in a Scala/SBT project, include a line like the following in a file named build.properties in your project/ subdirectory:

sbt.version = 0.11.3

So, if your project directory is named /Users/Al/Foo, the file would be here:

How to determine if your Java application is running on Mac OS X

If you're developing a Swing/Java application to run on multiple platforms, at some point you'll probably have to make some tweaks for each operating system. Yes, there are differences in Swing behavior between Mac OS X, Linux, and Windows, and you'll want to account for those.

Mac specific properties for Swing applications

I think I've mentioned parts of this in other blog entries, but as I was just digging through a Java Swing application that I wrote specifically for the Mac OS X platform, I ran across the following source code, which sets up all of my system properties for the Mac environment: