Skip to main content

Attaching external jar

4 replies [Last post]
ashokabk
Offline
Joined: 2008-08-25
Points: 0

Hi All,

When I add a external jar to development environment, it won't give any compilation error. But at the runtime, it will give class not found exception.

I followed this method

xlet.lib.zip is pointing to my external jar file

It is working file running fine in WINDVD.

But I don't want to expand/ unzip the externally attached jar and point it to classpath but I want it to add as a external jar like 00001.jar.
How to do this and how to make that jar file available to classpath at runtime

Is there any other way of doing this. Plz let me know

Thanks,
Ashoka B K

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chihiro_saito
Offline
Joined: 2006-11-08
Points: 0

Hi,

Your xlet can load additional classes from a different jar in the BDMV/JAR directory by having an entry in the corresponding BDJO file, in the classpath_extension of the Application descriptor section.

If you're using hdcookbook's BDJO's xml representation, then the syntax for 00001.jar should be something like this:




/00001

Chihiro

onebeartoe
Offline
Joined: 2011-08-24
Points: 0

Hi Chihiro, Ashoka,

I too was trying to get a third party JAR on the runtime and compile time classpath for a BD-J application. It was for one of the Grin examples. I made small changes to see if I could get the third party/external JAR incorporated.

Please note (so far) this has only worked for running the Grin viewer from the command line.

To use the external JAR at compile time, I added the JAR to the directory that contains the generic_build.xml file (under HDCOOKBOOK_HOME/xlets/GrinXlet). Then I made references to this JAR in generic_build.xml's various jdktools.javac targets:

    <jdktools.javac destdir="${build.dir}/gensrc/grinview" debug="on"
excludes="GrinXlet.java XletDirector.java">
    <src path="${build.dir}/gensrc/grinview" />
    <src path="src${se.lib.src.int}"/>
    <classpath>
<pathelement path="${grinview.jar}"/>
<pathelement path="${se.lib.zip}"/>
<pathelement path="jmf.jar"/>  <<<<----- this is the external JAR I added
    </classpath>
    </jdktools.javac>

To use the JAR at runtime, I added the external JAR alongside the build.xml for xlet I was modifying. In this case, it was HDCOOKBOOD_HOME/xlets/tests/functional/Playground. Then I modified the build.xml's various jdktools.java targets:

<jdktools.java classname="com.hdcookbook.grin.test.bigjdk.GrinView">
    <classpath>
<pathelement path="${grinview.jar}"/>
<pathelement path="${build.dir}/gensrc/grinview"/>
<pathelement path="${se.lib.zip}"/>
<pathelement path="jmf.jar"/>       <<<<----- this is the external JAR I added
    </classpath>
    <arg value="-asset_dir"/>
    <arg value="${asset.dir}"/>
    <arg value="-asset_dir"/>
    <arg value="${build.dir}/run-grinview"/>
    <arg value="-extension_parser"/>
    <arg value="${extension.parser}"/>
    <arg value="-director"/>
    <arg value="${show.director}"/>
            <arg value="${show.file}.txt"/>
        </jdktools.java>

This works for development, but I am not sure if this is the correct way to add a third party JAR for use on an actual Blu-Ray disk.

Running 'ant bundle' doesn't give any errors, but alas I have no Blu-Ray burner to create and test a disk.

Do you know if this method will work to make a third party JAR available to a BD-J app's classpath (once burnt to a disk)?

Also, you mentioned 'hdcookbook's BDJO's xml representation'. Where is the configuration for this? I found dist/BDMV/BDJO/00000.bdjo, but it seems to be a binary file.

Thanks,

Roberto

ashokabk
Offline
Joined: 2008-08-25
Points: 0

Hi Chihiro,

Thanks for the quick reply.

I could include multiple jars in /00001;/00002

Thanks again. Where can I find more detailed information about bdjo description file?

Regards
Ashoka BK

chihiro_saito
Offline
Joined: 2006-11-08
Points: 0

> Where can I find more detailed information about bdjo description file?

In BD-ROM spec Part3-2, section 10.2 "BD-J Object file", which describes the binary file format. Our BDJO tool's xml representation directly reflects that binary format.

It's the official specification from the BDA; you won't be able to get it for free, but I remember hearing that there's a content author license costing $500 or so...

Chihiro