Classpath conflict?

Sorry in advance for the long email. It is hard to be concise when you
don’t know what you are talking about…

My goal is to do basic scripting of a java swing GUI application, using
jruby with jemmy. I am a tester, and my knowledge of Java is limited
and I’m fairly green with ruby.

I played around with jruby, jemmy and the ‘swingset2’ demo app and that
seemed easy enough. Now I am trying to do something similar on a more
involved swing based app.

I have read some postings related to ‘classpath’ loading issue, but a
lot of this stuff is over my head. Here is my experiment… BTW, I am
on a Solaris platform using java 1.6.0_17 with jruby 1.5.1

I launched my GUI and looked at the java command arguments and options
used. I started my jruby with the same set of arguments. The
application classpath is very small, initially. The application is a
client/server application. The initial ‘jars’ are only to allow
communication between the client and server and determine if they have
the same version. If not, the client downloads a new set of jars (like
30 of them) and restart the application.

So it looks like the application is ‘adding’ jars during its execution
and I think that is causing some issue with jruby. The application
never launches successfully and reports a ‘nullPointerException’.

I managed to have partial source code of the app and connect a debugger
(via eclipse) [this is all new to me!] My script looks like

require ‘java’
require ‘file1.jar’

app = com.comp.app.Launch
app.main()

My guess on what is going on…

ClassA is part of file1.jar. I think it is referred to a ‘singleton’
pattern… That instance is used at the beginning of the application
start. When I think the application is changing its class path, the
‘file1.jar’ is ‘re-added’ again. After that point, once the ‘classA’
instance is used, it returns null.

By trial an error, I manage the change some config file, so the
application removed the ‘file1.jar’ that is ‘added’ to the classpath.
That got me a bit further as I didn’t get the nullpointer in the same
location. I am not sure where it is failing after, as I am not seeing
any errors in the log, but also not seeing my GUI appear. I don’t think
my ‘config’ file change is a 'valid solution and I am just moving the
problem around so I thought someone might have an idea on things I could
try.

I know it is hard to provide help with the limited information I can
provide, but thanks in advance for any suggestions…

Dany