home / blog

Tag Archives: java

Java class-loading woes

Another day, another OSGI headache. JAXB within OSGI. This won’t work by default. FYI: I’m more of a DOM / XPath fan, but some people insist on using JAXB. JAXBContext jc = JAXBContext.newInstance(“com.adamish.foo.jaxb”); This error is produced. “com.adamish.foo.jaxb” doesn’t contain … Continue reading

Posted in geek | Tagged , | Leave a comment

JNI asynchronous callbacks

If you’re using JNI, you may wish to callback a java method asynchronously. For example event handling from a win32 message pump. package com.adamish; public class Foo { public native void register(); public void callback(int val) { // do stuff … Continue reading

Posted in geek | Tagged , | 2 Comments

JavaFX hidden VM args

I’ve been trying to find a workaround for a NullPointerException in the Quantum render thread (RT-18645). During the process I looked at what VM args are read. I added a conditional breakpoint on System.getProperty(String) with code “System.out.println(arg0); return false”. Here … Continue reading

Posted in geek | Tagged , | Leave a comment

Jacorb 2.2.4 NamingService broken

The naming service jacorb appears to be broken in release 2.2.4. This is only really a problem if you’re working on a legacy project where you can’t use a more recent version. It allows clients to connect, but causes them … Continue reading

Posted in geek | Tagged , | Leave a comment

HTML support in JEditorPane

…is sadly lacking. Only HTML 3.2 features are supported, meaning HTML 4.01 niceties like having vertical-align attribute in CSS do not work. Amazingly the bug report on this is now 11 years old.

Posted in geek | Tagged , | Leave a comment

Android dev: custom view classes

Instantiating custom views. There is a no class attribute etc. if you’re trying to find one in the XML, instead the fully-qualified class name is used as the tag. <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <com.adamish.android.dmxapp.DmxView2d android:layout_width=”match_parent” android:layout_height=”fill_parent” android:id=”@+id/laser_pos_panel” /> </LinearLayout>

Posted in geek | Tagged , | Leave a comment

Android dev: handling touch events on custom views

Embarrassingly this tripped me up for a while. In a custom view there were only single “click” events being called when a finger was dragged across the screen. This was due to the return value from the method being false … Continue reading

Posted in geek | Tagged , , , | Leave a comment

Android dev: app navigation using back button

The back button can be used to navigate within an application. The easiest way to do this is to define multiple activities. Activities can be moved into using action buttons etc, and then can be exited using the back button. … Continue reading

Posted in geek | Tagged , , | Leave a comment

Spring XML + BeanInfos

Why can’t Spring XML be used to set property javax.swing.cursor? <bean id=”foo” class=”javax.swing.JPanel”> <property name=”cursor”> <bean class=”com.adamish.foo.CursorFactory” factory-method=”createCursor” /> </property> </bean> The resultant exception: org.springframework.beans.NotWritablePropertyException: Invalid property ‘cursor’ of bean class [javax.swing.JPanel]: Bean property ‘cursor’ is not writable or has … Continue reading

Posted in geek | Tagged , , | Leave a comment

SWT – no more handles

A colleague at work had this error. “SWT – no more handles” when using eclipse 3.6 SR1 on a windows XP machine. It turned out to be caused by hundreds of tabs being open – closing the tabs appeared to … Continue reading

Posted in geek | Tagged , | Leave a comment