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:
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.”:
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.”
You want to define abstract or concrete properties in an abstract base class (or trait) that can be referenced in all child classes.
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:
Java Mac FAQ: How can I determine whether my Java/Swing application is running on Mac OS X, or some other operating system?
Here's the test I use to determine whether my Java application is running on Mac OS X:
Wow, I just realized that until this morning I hadn't done anything new with Ant in several months. It sure is nice when things just work. :)