Wednesday, 25 April 2012

Embedding a OpenJDK 7 Java JRE in Poker Copilot

As of an upcoming new OS X version, Apple's Java team are encouraging Java developers to embed a Java JRE in our applications. Unfortunately Java on the Mac is not quite ready for us to do this. Nevertheless I'm doing my best to prepare for this, so that I can give helpful feedback on problems to Oracle and Apple in time.

Here's how I currently got an embedded JRE into Poker Copilot:

1) I downloaded and installed Oracle JDK7u4 Mac OS X Port Developer Preview.

2) I copied the JRE folder from the developer preview. I copied from:

/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre

to 

a folder in my app I called ./jre

I launched my application using this command line: (note that this is in a dev environment not in a OS X app bundle, hence the hard-coded path to idea_rt.jar and my app classes not being jar'ed)

jre/bin/java -Dapple.laf.useScreenMenuBar=true "-Xdock:name=Poker Copilot" -Xdock:icon=../creative/512icn.png -Xmx768m -classpath "jre/lib/charsets.jar:jre/lib/jce.jar:jre/lib/jfr.jar:jre/lib/jfxrt.jar:jre/lib/JObjC.jar:jre/lib/jsse.jar:jre/lib/management-agent.jar:jre/lib/resources.jar:jre/lib/rt.jar:jre/lib/ext/dnsns.jar:jre/lib/ext/localedata.jar:jre/lib/ext/sunec.jar:jre/lib/ext/sunjce_provider.jar:jre/lib/ext/sunpkcs11.jar:jre/lib/ext/zipfs.jar:out/production/DesktopApp:lib/*:/Applications/IntelliJ IDEA 11.app/lib/idea_rt.jar" com.barbarysoftware.pokercopilot.Launcher

For clarity, here's same command line broken into separate lines:

jre/bin/java -Dapple.laf.useScreenMenuBar=true "-Xdock:name=Poker Copilot" -Xdock:icon=../creative/512icn.png -Xmx768m -classpath "jre/lib/charsets.jar:jre/lib/jce.jar:jre/lib/jfr.jar:jre/lib/jfxrt.jar:jre/lib/JObjC.jar:jre/lib/jsse.jar:jre/lib/management-agent.jar:jre/lib/resources.jar:jre/lib/rt.jar:jre/lib/ext/dnsns.jar:jre/lib/ext/localedata.jar:jre/lib/ext/sunec.jar:jre/lib/ext/sunjce_provider.jar:jre/lib/ext/sunpkcs11.jar:jre/lib/ext/zipfs.jar:out/production/DesktopApp:lib/*:/Applications/IntelliJ IDEA 11.app/lib/idea_rt.jar" com.barbarysoftware.pokercopilot.Launcher

3) It runs! There are a couple of rendering issues which are known by the Oracle/Apple team working on the OpenJDK7 Mac OS X Port. Namely, progress bars don't progress, unified toolbars don't unify, and window resizing is graphically not good. But otherwise, it runs!

For further clarity: this is the list of files in the embedded JRE I have on my class path:

jre/lib/charsets.jarjre/lib/jce.jarjre/lib/jfr.jarjre/lib/jfxrt.jarjre/lib/JObjC.jarjre/lib/jsse.jarjre/lib/management-agent.jarjre/lib/resources.jarjre/lib/rt.jarjre/lib/ext/dnsns.jarjre/lib/ext/localedata.jarjre/lib/ext/sunec.jarjre/lib/ext/sunjce_provider.jarjre/lib/ext/sunpkcs11.jarjre/lib/ext/zipfs.jar

Some are most likely not needed.

Now the big issue: the JRE is adding 55 MB to my app bundle size. That's after I zip the JRE folder. I need to determine which files I can safely remove from the JRE. But even then, the biggest file is the non-optional rt.jar, which compresses to 21 MB.

 

German Culture...

…how I miss you.

The Beard and Moustache Championships: http://www.bbc.co.uk/news/world-europe-17835860

Sunday, 22 April 2012

Sentences of the Day

The first sentence is a marvel. The second is amusing:

I was slightly surprised when a friend pointed out there are three books in Amazon's "Books › Fiction › Erotica › Global Warming & Climate Change" section. I thought there would be more.

Read the whole article here.

Thursday, 19 April 2012

Google and Flight Codes

Google is still doing some great things. My friend is arriving today at Barcelona airport. I wanted to make sure her flight was on time, so I entered the flight code into Google. Here's what I got:

Screen Shot 2012 04 19 at 2 01 34 PM

Perfect. Exactly the information I needed. Time to arrival and the arrival terminal.

 

 

Wednesday, 18 April 2012

Strange Maps

is my new favourite blog. And book.

He also writes fascinating detailed articles about cartographical oddities in the NY Times.

iPad Development or Reading Science Fiction

I'm experimenting with my first iPad app, a simple Hello World app. The amount of obscure vocabulary, verging on meaningless is like the reading the first few pages of a hardcore science fiction novel. My favourite: I need to create a "provisioning profile", which I partly store in the "portal". The full phrase: "First, create a distribution provisioning profile using iOS Provisioning Portal".

These words and terms are introduced with no definition. One's eyes must glaze over, hoping that the meanings of the terms become clear later.

Thursday, 5 April 2012

iPad Apps, polished and raw

I've had my iPad almost a week, and I've been trying and buying several apps to get a feel for what's possible on the device.

Usually the apps that are recommended or grab my attention and polished. The interface, the appearance, the transitions all are top class.

One app in particular though, has a clumsy, unpolished user interface. Yet I've been using that app often. It's the NY TImes Crosswords app. You see, I'm a crossword fanatic, living in a country where my mother tongue, English, is a foreign language. So I'm deprived of good crosswords I can do. I'm willing to the accept the raw user interface because I want what the app can offer me so badly. To some degree I guess they have a monopoly on NY Times crosswords.

 

Wednesday, 4 April 2012

Google Going Backwards?

I try not to rant or be negative when blogging…but…in recent months i've been puzzled by Google. I use many of their sites daily. Those sites seemed to keep improving. But I've been noticing some going backwards. Becoming harder to use. Becoming cluttered, confusing, and surprising. The three in particular that really get to me:

* Google Mail

* Google Reader

* Google Groups

* Google Search (search for 'Foobar', then click on the "images" link in the top menu, then "Maps", then "News". Images and Maps keep the search phrase, News doesn't. Puzzling. This behaviour differs on the left-hand menu. Damn puzzling.)

I realise these are free offerings, so I might have no right to complain. I agree. I just can't figure out why these web sites are getting worse. Especially given that they are most likely widely used internally at Google. Surely people at Google are also frustrated by the changes.

Monday, 2 April 2012

My Thoughts on Developing Apps for iPad

I purchased my first iPad last week. I bought it for the purpose of developing iPad apps. Why?

In the last three months of 2011, Apple sold 15.4 million iPads. A lot? Yes. Current trend? Upwards. Way upwards.

Buying apps on an iPad is mostly an low-friction impulse purchase.

An iPad is expensive. Someone who can afford an iPad is likely to have a reasonably high level of disposable income.

There are many iPad apps already, the vast majority of which earn little to no money. This is because developing a simple iPad is just challenging enough for a software developer with a new iPad to enjoy, while being just easy enough to complete. However these developers usually don't realise that running a successful business involves more than just realising a simple app, then sitting back sipping cocktails on a Caribbean beach. A successful business requires skill, persistence, and luck.

My feeling is that if I create some apps that appeal to people, then listen to feedback, and improve, improve, improve, this can be a viable business. Does it require some luck? Indeed. But it also requires business skills, software development skills, an ability and willingness to continually learn, and the secret ingredient: persistence.

 

 

Umwelt

This XKCD is clever - read the 'mouseover' text then try increasing/decreasing your browser window size, or zoom in and out.

Although as a speaker of German as a foreign language, I translate "Umwelt" simply as "environment".