NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JAR classpath with Jython



Hi Wim,
Don Murray forwarded me your email.

On the request of Valentijn I am trying to make something extensible. We want to program in Java, as a first step we want to call that Java
code from Jython, perhaps later we want to make a closer integration
between our code and IDV. Preferably by not changing anything in the
standard distribution but just adding some jar-files's.

When I load IDV in Eclipse and put our .jar in the classpath everything
works fine.

When I load IDV outside the debugger it does not work.
I am new to IDV and new to Jython, so it can be that I am overlooking
something trivial.
Setting the classpath on the commandline does not work with -jar.
Setting the classpath in the manifest does not work, it cannot find my
class files.

You should be able to run the idv using -classpath and supplying the main idv class name,
not running it with -jar. This should work:
java -Xmx512m -classpath idv.jar:/any/other/jar/file ucar.unidata.idv.DefaultIdv

To include other jython code yo can do a variety of things:
Have your jython code in a file called "default.py" and put it on a web
site or a file system. Run the idv with:
-sitepath /the/file/system/directory/where/you/put/the/jython
or:
-sitepath http://www.foo.bar/where_you_put_the_jython

Or:

If you have multiple jython files then modify the idv.rbi file that is
in your .metapps directory:
/your/home/directory/.metapps/DefaultIdv/idv.rbi

There is more documentation here:
http://my.unidata.ucar.edu/content/software/idv/docs/userguide/SiteConfiguration.html

Or:
In the release there is an unpublicized and somewhat untested extensions feature of the idv. In your .metapps/DefaultIdv directory there should be a subdirectory called extensions The idv will attempt to load class files in any jar files found in that directory. If there is a file called default.py in any of the extension jars it will also load those
files.  You can try this out but there are no guarantees about this feature.


-Jeff