Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


Problems to use one-jar from servlet

  • Jeremic Zoran
    Jeremic Zoran


    I'm newby in this and I like it, but I have experienced some problems to configure it to work with my PHP application.

    Firts problem is that I don't know how to configure some resources (rdf files) that are used by my classes to be available when packed in jar file together with classes. I have make build.xml like this:
    <one-jar destfile="hello.jar" manifest="">
                    <!-- Construct main.jar from classes and source code -->
                    <fileset dir="${classes.dir}/src"/>
                    <fileset file="${build.dir}/lib.jar" />
                    <fileset file="${resources.dir}/antlr-2.7.5.jar.jar" />
                                   <fileset file="${resources.dir}/arq.jar" />
                                <fileset file="${resources.dir}/commons-logging-1.1.jar" />
                                <fileset file="${resources.dir}/concurrent.jar" />
                                <fileset file="${resources.dir}/d2rq-0.5.1.jar" />
                                <fileset file="${resources.dir}/icu4j_3_4.jar" />
                                <fileset file="${resources.dir}/jena-2.5.1-rdql.jar" />
                                <fileset file="${resources.dir}/jena.jar" />
                                <fileset file="${resources.dir}/json.jar" />
                                <fileset file="${resources.dir}/junit.jar" />
                                <fileset file="${resources.dir}/log4j-1.2.12.jar" />
                                <fileset file="${resources.dir}/mysql-connector-java-5.1.5-bin.jar" />
                                <fileset file="${resources.dir}/openrdf-model.jar" />
                                <fileset file="${resources.dir}/openrdf-util.jar" />
                                <fileset file="${resources.dir}/rio.jar" />
                                <fileset file="${resources.dir}/sesame.jar" />
                                <fileset file="${resources.dir}/stax-api-1.0.jar" />
                                <fileset file="${resources.dir}/wstx-asl-3.0.0.jar" />
                                <fileset file="${resources.dir}/xercesImpl.jar" />
                                <fileset file="${resources.dir}/xml-apis.jar" />
                                <fileset file="${lib.dir}/**"/>
                <fileset dir=".">
                    <include name="resource/**"></include>
    It copies all rdf files in folder resource under the root of hello.jar. However, they are not available from my class. I get the error message:

    ERROR rethrew: resource\mappingMoodle.n3 (The sys
    tem cannot find the path specified)

    Second problem is that I can't start it from PHP using PHP/Java bridge. I can start hello.jar from command prompt, but if I call some class from this package I'm always get an error message

    [[o:ClassNotFoundException]:"java.lang.ClassNotFoundException: Could not find depths.moodle.RepositoryFactory in java_require() path. Please check the path and the SEL and File permissions." at: #-10 #-9

    Here is the PHP code that I have used


    echo "<br>";
    $repository=new Java("depths.moodle.RepositoryFactory");

    I hope that somebody can help me to solve these problems