Access restriction: The constructor NotSupposedToUseThisClass() is not accessible due to restriction on required library

So following from my previous post about compiling Java 5 with a Java 6 compiler and the real reason that I am posting today, was to talk about a curly error message I got in Eclipse today.

I had the same Eclipse 3.7 project both on Windows and Mac, but only the Mac version complained with a very unusal message.

sun.misc.Base64 on mac JDK 5

The complaint was against an internal sun.misc.Base64Encoder class which every 2nd Java dev on the internet recommends replacing its internal implementation with an Apache Commons alternative.

Initially I thought it had something to do with the manifest and access restrictions preventing code outside of the jar accessing the internal code – something I recall the JavaPosse talking about from their days of Java Studio. Since it was only isolated to the Mac JDK, perhaps Apple had included these restrictions in the manifest for the classes.jar that these classes were defined.

Turns out it has to do with Eclipse.  I found out that when I add a JRE/JDK in Eclipse, it appears to add Access Rules to a bunch of select classes in the classes jar.  Its a white list.  Anything not there is forbidden.

I don’t know what defines this, and they are ‘non modifiable’ but adding in an access rule at the top leads this to go.

Java Build Path with Access Rules avoided

Looks like this has been tormenting people since Eclipse 3.3

Like rt.jar for like javac

Today I switched an Eclipse project using JDK 6 on OS X to JDK 5.

Even though there are command line tags in javac to produce 1.5 compatible source, the need to use JDK 5 comes into being when implementing interfaces that have grown in the number of methods since Java 5.  A good example is the JDBC classes.  The number of methods in Java 6 versions of the java.sql.Connection interface has grown by at least 6 (look for Since 1.6)

Having the Java 6 rt.jar or classes.jar where that interface resides will expect those new methods to be implemented and lead to a compilation error when you try to build.  On the opposite end, if you blindly start using the latest version of Java, you can easily start using new methods without realising.  Your colleagues will tell you when their 1.5 only environment stops compiling. 🙂

Building Jetty-Ant for Jetty 7

Jetty-ant for Jetty 7 is a hard find.
The documentation is all wrong, but that if you look at the Jetty Developer page they do concede that.
The split between eclipse and codehaus doesnt help either. There are a lot of options to try and search, Maven repo (, other bits in (, eclipse vs hightide release dirs (,…. aaarghh!
To make things extra sucky, the SVN URLs in the doc for where you get jetty-ant have moved too.
After a lot of searching it looks like this one is the key
instead of the one the docs refer to ( ) which 404s.

There are a lot of other resources that are required jetty-integration-project is req’d by the POM.  Its created in the main jetty-7 that I linked above.  Build that first (I only got as far as building the hightide-distribution) but it was enough to download all the required jars to build jetty-ant.  Phew!


in super short

svn co
cd jetty-7
mvn install

… builds a few different things, ultimately fails

cd jetty-ant
mvn install

… great success (now I just have to try it out – found in jetty-anttargetjetty-ant-7.5.0-SNAPSHOT.jar)

EDIT: When I last checked the documentation on the Eclipse documentation notes, it had thankfully been updated with an updated URL to download the ant target directly (18 Dec)


MacBook Pro vs Soniq TV vs HDMI adaptor

Most things on the Mac are purportedly easy since many of the un-ncessary options are removed.  This is great until you want to non-conform (read, use some hardware that is old, cheap, or just un-ordinary).

Trying to get HDMI with sound working through a Kanex iAdapt v2 mini display port, proved to be tricky due to the lack of options and just some wierdness of HDMI in general.

The other player in this whole mess was my cheopo year old 32″ Soniq QSL 322 LCD TV5.  Its been great so far, I’ve used HDMI connections to a couple of PVR units without problem.

When I plugged everything on the Mac though, even though it automatically recognised the display, the sound would still come through the laptop speakers.  Turns out thats a Sound System Preference Panel option to switch that. (option + F11)

Quick win right? Wrong, still no sound!  Rebooting, changing the order things were switched on.  Turning the volume up on the TV didnt do anything.  Also, while your Mac sound output is HDMI, the volume controls (F11/F12) dont do squat!

Then I tried a different tack.

I rebooted into Bootcamp (win 7 64bit) & the sound was working fine. There was a bit of a hiss in the background, and if no sound for a few seconds, the sound would switch off for a while – no hiss – until I played something again.  There would be a 1/2 sec delay waking up from the silence but otherwise ok for watching movies and music.  I later learnt from Kanex support that this is normal part of HDCP (the handshake that your devices do with each other to make sure they aren’t pirates. aarrrrrrr!)

When I rebooted back into OS X, the sound continued to work fine.

However once I put my computer to sleep and rewoke it, whilst leaving everything plugged in, the sound on the TV stopped working.

I recall reading on the apple support forums that there was some issue to do with HDMI handshaking and turning the devices on and off in a different order would fix the problem. It would appear for me that if the TV is on HDMI input first, then the mac is booted up sound can work.

I thought that was good enough but I found I could do one better and fix the sound whilst the Mac was already on.

I also read about a MIDI control panel that could be used to change how the digital output is sent via HDMI. Eventually I found it in Applications->Utilities-> Audio Midi Setup (not System Preferences).

I found that the HDMI ‘LCD TV’ device was at Format 96000.0 Hz. When I changed this down to 48000.0Hz then I could hear a sound through my TV speakers again. (Another way to get sound working, was press ‘Configure Speakers…’ button on the same screen and do a speaker test which also triggered the TV sound again)

So after changing down to 44100, the sound seems to work consistently on each plugin.  And if I ever do loose the sound again, I can get it back through here without needing to reboot my mac, tv, etc.

[Presentation] Tomorrow’s Tech Today: HTML5

Groovy / Grails ‘personality’  (and I mean that in the most fondest use of the term) Scott Davis presents a great round up of some cool HTML features.

InfoQ: Tomorrow’s Tech Today: HTML5.

He introduces some good tools and utils that help the forward compatible specification be read by HTML4 browsers none the wiser.

Firstly the HTML5 CSS trick to treat all the new HTML5 elements (header, nav, footer, video) to be treated as block elements in all browsers (except IE) and the html5shiv that does the same thing for IE.

Trivia: <input type=”someType”> gets rendered as a textbox if yourbrowser doesnt knowhow to show it.

There are some references to these sites which talk more about HTML – an upcoming o’reilly book you can read for free here

HTML 5 Rocks

He talks about some stuff I wasnt too aware of such as HTML5 caching support (5mb) and SQL (25mb but no FF or IE, but useful for iPhone and Android browsers)

Modernizr (detect support for HTML5 & CSS3) – see for an example.

“The goal is to program for HTML 5 and backfill for the rest of the browsers”