As I learned recently, the Mac/Java AppBundler tool is a little out of date these days, but you can still use it with Java 8 and MacOS 10.12 to build Mac/Java applications. One problem you can run into is getting this ugly Info.plist error:
I just started working with the Android Room database persistence library, and since you’re not supposed to run things like database queries on the main thread (the UI thread), I was looking at other ways to run them.
In general, you probably won’t want to run database queries using a
Thread, but just to see how Room works, I wrote this Java Thread code, and confirmed that it works as expected:
If you need to iterate over the elements in a
Map in Java 8, this source code shows how to do it:
Map<String, String> map = new HashMap<String, String>(); map.put("first_name", "Alvin"); map.put("last_name", "Alexander"); // java 8 map.forEach((k,v)->System.out.println("key: " + k + ", value: " + v));
Here’s a short article on dzone.com that explains why you might not need to use
StringBuilder in Java any more.
I noticed recently that a Scala/Java Swing application I am developing on Mac OS X 10.9 has blurry text when it’s run as a Mac application. The text looks fine when I run the application through SBT, but looks blurry when I package it and run it as a Mac OS X application.
A solution is to put this text in the application’s Info.plist file:
As a quick note to self, I used the following Ant build.xml file in 2014 to build my Wikipedia Reader client application on Mac OS X 10.9 with Java 7.x:
I just ran across this link in my email about the Chief Architect of the Java Platform Group at Oracle, with his thoughts about how to proceed on the Java 7 and Java 8 platforms releases. I haven't paid attention to the "New Java Features" world in a while, but it's a short, interesting read about how they're thinking about proceeding with the Java 7 and Java 8 platform releases.
Java FAQ: Can you show me an example of the Java 5 for loop syntax? (Java 5 and newer)
Answer: Sure. I've created a sample Java program to demonstrate the Java 5 for-each loop syntax, using both a List with pre-Java5 syntax, and a second example using Java 5 generics syntax.
Java 5 for loop syntax example
Without any further ado, here is the example code: