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(“”); This error is produced. “” doesn’t contain ObjectFactory.class or jaxb.index Workaround, manually pass in a class-loader to the overloaded newInstance() method. ClassLoader… Continue reading Java class-loading woes

Categorized as geek Tagged ,

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 } } Step one is to have a “register” method which lets the C++ code… Continue reading JNI asynchronous callbacks

Categorized as geek Tagged ,

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 are the values I found, sorted and with non-JavaFX options removed. com.sun.scenario.animation.adaptivepulse com.sun.scenario.animation.AnimationMBean.enabled com.sun.scenario.animation.nogaps decora.purgatory… Continue reading JavaFX hidden VM args

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 to throw the following exception when trying to resolve a name. org.omg.CORBA.BAD_INV_ORDER: Server-side Exception: The… Continue reading Jacorb 2.2.4 NamingService broken

Categorized as geek Tagged ,

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.

Categorized as geek Tagged ,

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=”” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> < android:layout_width=”match_parent” android:layout_height=”fill_parent” android:id=”@+id/laser_pos_panel” /> </LinearLayout>

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 (default in eclipse when you choice source: override methods. Changing it to true means that… Continue reading Android dev: handling touch events on custom views

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. This should work to any number of levels. Activities are defined in AndroidManifest.xml. Below is… Continue reading Android dev: app navigation using back button

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=”” 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 an invalid setter method. Does the parameter type of the setter match the return type… Continue reading Spring XML + BeanInfos

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 fix the error.