How to add this XML file to classpath?
# java -classpath . dk.firma.klient.webservice.OiosiRaspClient
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="lib/axis2/transport/axis2-transport-base-1.0-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/axis2/transport/axis2-transport-mail-1.0-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-adb-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-adb-codegen-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-ant-plugin-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-clustering-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-codegen-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-corba-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-fastinfoset-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-java2wsdl-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-jaxbri-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-jaxws-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-jibx-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-json-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-kernel-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-metadata-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-mtompolicy-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-spring-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-saaj-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-transport-http-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-transport-local-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axis2-xmlbeans-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/apache_commons/collections/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="lib/apache_commons/configuration/commons-configuration-1.6.jar"/>
<classpathentry kind="lib" path="lib/apache_commons/jxpath/commons-jxpath-1.3.jar"/>
<classpathentry kind="lib" path="lib/apache_commons/lang/commons-lang-2.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/activation-1.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axiom-api-1.2.8.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axiom-dom-1.2.8.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/axiom-impl-1.2.8.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/bcel-5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/commons-codec-1.3.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/commons-fileupload-1.2.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/commons-httpclient-3.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/commons-lang-2.3.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/geronimo-annotation_1.0_spec-1.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/geronimo-jaxws_2.1_spec-1.0.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/geronimo-stax-api_1.0_spec-1.0.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/geronimo-saaj_1.3_spec-1.0.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/geronimo-ws-metadata_2.0_spec-1.1.2.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/httpcore-4.0.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jalopy-1.5rc3.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jaxb-api-2.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jaxb-impl-2.1.7.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/XmlSchema-1.4.3.jar"/>
<classpathentry kind="lib" path="lib/axis2/mercury/mercury-core-0.91.jar"/>
<classpathentry kind="lib" path="lib/axis2/mercury/mercury-persistence-0.91.jar"/>
<classpathentry kind="lib" path="lib/axis2/rampart/opensaml-1.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/rampart/rampart-core-1.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/rampart/rampart-policy-1.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/rampart/rampart-trust-1.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/rampart/wss4j-1.5.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/rampart/xmlsec-1.4.1.jar"/>
<classpathentry kind="lib" path="lib/backports/backport-util-concurrent.jar"/>
<classpathentry kind="lib" path="lib/openuddi/openuddi-client-1.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jaxb-xjc-2.1.7.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jaxen-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jettison-1.0-RC2.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jibx-bind-1.2.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/jibx-run-1.2.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/mail-1.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/mex-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/neethi-2.0.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/smack-3.0.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/smackx-3.0.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/soapmonitor-1.5.1.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/woden-api-1.0M8.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/woden-impl-dom-1.0M8.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/wsdl4j-1.6.2.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/wstx-asl-3.2.4.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/xalan-2.7.0.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/xercesImpl-2.6.2.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/xml-apis-1.3.02.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/xmlbeans-2.3.0.jar"/>
<classpathentry kind="lib" path="lib/axis2/core/xml-resolver-1.2.jar"/>
<classpathentry kind="lib" path="lib/bouncycastle/bcpkix-jdk15on-147.jar"/>
<classpathentry kind="lib" path="lib/bouncycastle/bcprov-jdk15on-147.jar"/>
<classpathentry kind="lib" path="lib/nemhandel/dk.gov.oiosi.library-2.1.0.21718.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
You can't do it the way you want. You can't add a .classpath file (generated by eclipse I guess) directly in the command line. You need to use an external tool like ant, maven or gradle for doing the job. Or you can add by hand all the listed dependencies inside the MANIFEST file of your main jar.
Edit : Solution with Ant
1-Open your build.xml file
2-Add Path element :
<path id="dep.runtime">
<fileset dir="paht/to/external/dependency/dir" includes="**/*.jar"/>
</path>
A path element is an abstraction use to describe librairies needed for your project. So, it must reflect dependencies kind="lib" of your .classpath file. In your case I give you the beginning of your path and hope that It will help you to understand how it works. If not google is your friend.
<path id="dep.runtime">
<fileset dir="lib/axis2/core" includes="**/*.jar"/>
<fileset dir="lib/axis2/rampart" includes="**/*.jar"/>
<fileset dir="lib/axis2/transport" includes="**/*.jar"/>
<fileset dir="lib/apache_commons" includes="**/*.jar"/>
<fileset dir="lib/axis2/mercury" includes="**/*.jar"/>
<!--you need to complete this list by inspiring you of those examples -->
</path>
3-Add a Jar element inside a target call "jar" which depends on target responsible to compile your java files.
<target name="jar" depends="compile">
<!-- This element will write inside the manifest file all your dependencies needed to execute your project.-->
<manifestclasspath property="manifest_cp" jarfile="myProject.jar" maxParentLevels="10">
<!-- This is the reference to your classpath description inside element path -->
<classpath refid="dep.runtime" />
</manifestclasspath>
<jar jarfile="myProject.jar" basedir="./src">
<manifest>
<attribute name="Main-Class" value="dk.firma.klient.webservice.OiosiRaspClient"/>
<attribute name="Class-Path" value="${manifest_cp}"/>
</manifest>
</jar>
</target>
4-Launch your build.xml with ant (make sure that ant use the target named "jar"). Normally, if all goes well it has generated a jar called myProject.jar. If you open it with a zip tool, you will see a META-INF/MANIFEST.MF file. Inside it, there is a Class-path line where all your dependencies are listed.
5-Type the command line java -jar myProject.jar
If all goes well, it will launch your program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With