Mark (but others might be interested),
On 2005 Dec 19 , at 10.13, Mark Taylor wrote:
> On Fri, 16 Dec 2005, Brad Cavanagh wrote:
>
>> On Wed, 14 Dec 2005, Norman Gray wrote:
>>
>>> There seems to be an updated list of instructions for Java
>>> packaging at
>>> <http://developer.apple.com/documentation/Java/Conceptual/
>>> Java14Development/index.html>.
>
> Sounds not much good then - whatever I use really has to be something
> I can run from linux under control of ant (or similar).
> If you feel like taking a look Norman it miiight be interesting to
> see if it does actually fix up the menus business, but probably
> not worth more than minimal effort.
I've taken a look at this, and it's almost working, but there are a
couple of problems, both and and Java.
I've made an OS X application bundle for Treeview (ie, something you
can drag around, which looks pretty, and which you can double-
click). I've made it completely standalone, so that it contains all
of the required jar files and libraries internally, and isn't
dependent on having any other jars installed elsewhere (it ends up at
21 MB). It would I'm sure be possible to create a version which
referred to jars installed elsewhere, though the sort of path-editing
which would be require for that would most naturally be done as part
of a more elaborate OS X install of the Starlink Java applications.
That might in fact be easy (for some post-quite-a-lot-of-
documentation value of `easy'), but I'm not volunteering.
Ant-related problems:
1. I've ended up using a specialised ant task for this <http://
www.loomcom.com/jarbundler/> -- is that OK, and what should I do as
regards this and the repository. Given that it should be checked in,
where should it go? In java/source/ant? It's no great problem if we
can't use this, however, as I'd almost fully done it by hand already,
and it was I think only the problem below which forced me to start
googling.
2. Is there a way, in ant, of converting a classpath (in fact an
extclasspath) into a FileSet, so that I can produce a list of all the
jar files which have to be copied into the bundle? My impression
from the ant docs was that there was not, and that the classpath and
fileset types were fully distinct, but is there therefore a different
way of going from the carefully constructed extclasspath, containing
the full set of dependencies, to the list of jars. What I ended up
doing was using XSLT to grub through the .jnlp files in java/lib, and
using the result in an <includesfile>. But it's not obvious how to
automate that within ant, and it doesn't seem a terribly robust
solution, since the set of dependencies in the .jnlp files, and the
largely equivalent dependencies in the Treeview build.xml, are
apparently being maintained in parallel. Am I missing something?
3. Oh, I used the TREE27.gif image, that you use in the Treeview
documentation pane, as the application item -- is that all right, Mark?
Java-related problems:
4. When I try running the generated application, I get the results
below. These show, first, Treeview failing to find libjniast.jnilib
and libjnihds.jnilib. But is it looking for them in the correct
way? It's looking in .../Treeview.app/Contents/Resources/lib/ppc/
libjniast.jnilib for the first one; that's not far off, but it should
instead be looking inside .../Treeview.app/Contents/Resources/Java/
ppc/jniast_libs.jar, which is in the classpath. I'm not sure how to
debug this, but is it possible that whatever it is that's loading
this is making an unwarranted assumption about library layouts (I'd
guess not, since the JNLP stuff has been sorted out, but...).
5. Part of the point of all this was that Treeview seemed to have
stopped working when the application menus were moved to the screen
menubar on OS X. Well, it's still not working. In the dump below,
Treeview is halting with an ArrayIndedOutOfBounds exception (as
before), which appears to be at the pack() in Treeview's
StaticTreeViewer.java. Is it possible, Mark, that there's actually
something amiss round here, which possibly changed fairly recently,
and which somehow hasn't been exercised before? I haven't made any
changes to Util's tweakGuiForMac, but I can see that's a no-op at
present.
It works OK when I turn this feature off, and let the menus appear on
the application window. In case it's useful to see the precise
layout, I've put the bundles with the property set and not set at
<http://nxg.me.uk/temp/Treeview.app-screenmenu.tar> and <http://
nxg.me.uk/temp/Treeview.app-no-screenmenu.tar> respectively (if it's
useful, you should be able to start up the Java inside them
straightforwardly, though there's obviously only the ppc jni
libraries there).
Grrr. It looks like this may be an Apple bug, as there's at least
one other report of this (<http://lists.apple.com/archives/java-dev/
2005/Aug/msg00060.html> -- includes a bug number, but bloody Apple's
bug database isn't public, so no hint of a workaround or engineering
analysis). All the same, I'm puzzled why, if this is a real bug, it
seems to have bitten so very few people. I've mailed the guy who
posted that message, so we'll see if he'd managed to work anything out.
Jan 10, 2006 2:15:26 PM uk.ac.starlink.ast.AstPackage isAvailable
INFO: java.lang.UnsatisfiedLinkError: couldn't load library jniast:
Can't load library: /Volumes/Boltzmann/Starlink/trunk/java/source/
treeview/release/Treeview.app/Contents/Resources/lib/ppc/
libjniast.jnilib
java.lang.UnsatisfiedLinkError: couldn't load library jniast: Can't
load library: /Volumes/Boltzmann/Starlink/trunk/java/source/treeview/
release/Treeview.app/Contents/Resources/lib/ppc/libjniast.jnilib
at uk.ac.starlink.util.Loader.loadLibrary(Loader.java:146)
at uk.ac.starlink.ast.AstObject.<clinit>(AstObject.java:43)
at uk.ac.starlink.ast.AstPackage.isAvailable(AstPackage.java:36)
at uk.ac.starlink.datanode.nodes.NodeUtil.hasAST(NodeUtil.java:78)
at uk.ac.starlink.treeview.Driver.main(Driver.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at apple.launcher.LaunchRunner.run(LaunchRunner.java:88)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
at apple.launcher.JavaApplicationLauncher.launch
(JavaApplicationLauncher.java:52)
Caused by: java.lang.UnsatisfiedLinkError: no jniast in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at uk.ac.starlink.util.Loader.loadLibrary(Loader.java:111)
... 11 more
Jan 10, 2006 2:15:27 PM uk.ac.starlink.ast.AstPackage isAvailable
WARNING: JNIAST load failed - no WCS processing
Jan 10, 2006 2:15:27 PM uk.ac.starlink.hds.HDSPackage isAvailable
INFO: couldn't load library jnihds: Can't load library: /Volumes/
Boltzmann/Starlink/trunk/java/source/treeview/release/Treeview.app/
Contents/Resources/lib/ppc/libjnihds.jnilib
java.lang.UnsatisfiedLinkError: couldn't load library jnihds: Can't
load library: /Volumes/Boltzmann/Starlink/trunk/java/source/treeview/
release/Treeview.app/Contents/Resources/lib/ppc/libjnihds.jnilib
at uk.ac.starlink.util.Loader.loadLibrary(Loader.java:146)
at uk.ac.starlink.hds.HDSObject.<clinit>(HDSObject.java:96)
at uk.ac.starlink.hds.HDSPackage.isAvailable(HDSPackage.java:34)
at uk.ac.starlink.datanode.nodes.NodeUtil.hasHDS(NodeUtil.java:65)
at uk.ac.starlink.treeview.Driver.main(Driver.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at apple.launcher.LaunchRunner.run(LaunchRunner.java:88)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
at apple.launcher.JavaApplicationLauncher.launch
(JavaApplicationLauncher.java:52)
Caused by: java.lang.UnsatisfiedLinkError: no jnihds in
java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at uk.ac.starlink.util.Loader.loadLibrary(Loader.java:111)
... 11 more
Jan 10, 2006 2:15:27 PM uk.ac.starlink.hds.HDSPackage isAvailable
WARNING: JNIHDS load failed - no HDF/HDS access
apple.awt.EventQueueExceptionHandler Caught Throwable :
java.lang.ArrayIndexOutOfBoundsException: 4 > 3
java.lang.ArrayIndexOutOfBoundsException: 4 > 3
at java.util.Vector.insertElementAt(Vector.java:557)
at apple.laf.ScreenMenuBar.add(ScreenMenuBar.java:266)
at apple.laf.ScreenMenuBar.addSubmenu(ScreenMenuBar.java:207)
at apple.laf.ScreenMenuBar.addNotify(ScreenMenuBar.java:53)
at java.awt.Frame.addNotify(Frame.java:478)
at java.awt.Window.pack(Window.java:436)
at uk.ac.starlink.treeview.StaticTreeViewer.<init>
(StaticTreeViewer.java:222)
at uk.ac.starlink.treeview.Driver$2.run(Driver.java:228)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:189)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:478)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
--
------------------------------------------------------------------------
----
Norman Gray / http://nxg.me.uk
eurovotech.org / University of Leicester, UK
|