JAR file which needs other JAR files

Hi,
I try to run a jar file, which imports some external classes. These classes are in the library "reader.jar", which is added to the classpath. But if I start it with ...
     D:\TestProject>java -cp ./reader.jar -jar viewer.jar
... I get an error: java.lang.NoClassDefFoundError: de/readers/TestReader
If I copy the file "reader.jar" to "... j2sdk1.4.2/jre/lib/ext", I can start
"viewer.jar" successfull with ...
     D:\TestProject>java -jar viewer.jar
Why can't I add "reader.jar" to the classpath or why is it not used by Java?

When you run JAR's, you can not use the classpath defined at the command prompt (well, you can use it, it is just ignored). The JAR has its own class path defined in its manifest file. Add:
CLASS-PATH: reader.jar
to the manifest file of the viewer.jar and it should work.

Similar Messages

  • How to run a jar file which needs another jar to be in the class path

    Hi,
    I need to execute a jar, which needs another jar to be in the classpath.
    If I run like
    java -classpath <jar1 name> -jar <main jar>
    It is giving classnotfoundexception, where as the class is available in the <jar1 name>.
    so, currently I am doing like this
    In the manifest file i have given like
    Main-Class: <class name>
    Class-Path: <jar name> <jar name2>
    then it is running fine. But, if I want to change the jar location again I need to changed the manifest file.
    Is there any way to do this? Pls help me.

    How about
    java -cp jar1.jar;jar2.jar com.acme.MainClass
    You won't need to worry about the manifest file after that and you can make a bat files (or .sh file in *nix) for it.                                                                                                                                                                                                                                                                                                                                                                       

  • Register XSD-Files which includes Other XSD-Files

    Hallo
    i have two XML-Schemata. One is included by the other.
    Here is an example:
    This is the XSD, which is included by the other (metadata.xsd):
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
         <!-- Metadatenbereich für das xml-Dokument selbst-->
         <xs:element name="metadata" type="metadataType">
              <xs:annotation>
                   <xs:documentation>ROOT ELEMENT von Metadata</xs:documentation>
              </xs:annotation>
         </xs:element>
         <!-- Glossar: Metadatenbereich + Glossarinhalt als Liste von Glossareinträgen -->
         <xs:complexType name="metadataType">
              <xs:sequence>
                   <xs:element ref="identifier"/>
                   <xs:element ref="category"/>
                   <xs:element ref="creator"/>
                   <xs:element ref="creation_date"/>
                   <xs:element ref="publisher"/>
                   <xs:element ref="language"/>
                   <xs:element ref="title"/>
                   <xs:element ref="basic_year"/>
                   <xs:element ref="statistic"/>
    This is the XSD, which include the other XSD (lexikon.xsd):
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="unqualified" attributeFormDefault="unqualified">
         <!-- Includieren der Metadaten-->
         <xs:include schemaLocation="metadata.xsd"/>
         <!-- ROOT Element von Lexikon-->
         <xs:element name="lexikon" type="lexikonType" xdb:defaultTable="LEXIKON">
              <xs:annotation>
                   <xs:documentation>ROOT ELEMENT</xs:documentation>
              </xs:annotation>
         </xs:element>
         <xs:complexType name="lexikonType">
              <xs:sequence>
                   <xs:element ref="metadata"/>
                   <xs:element ref="lexikonEntries"/>
              </xs:sequence>
              <xs:attribute name="lexikonKat" type="xs:integer">
                   <xs:annotation>
                        <xs:documentation>für spezielle UnterkategorienTypen zu den Lexikas</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
         </xs:complexType>
         <!---->
         <!-- GLOSSAR-ELEMENTE -->
         <!---->
         <!-- ExplicationTxt-->
         <xs:element name="explicationTxt" type="explicationType"/>
         <xs:complexType name="explicationType">
              <xs:choice>
                   <xs:element ref="verweis"/>
                   <xs:element ref="txt"/>
                   <xs:element ref="para"/>
    Both documents have i copied to a webdav-folder. Now i want register the documents.
    BEGIN
    DBMS_XMLSchema.registerSchema(
    schemaurl=>'http://190.1.1.148:8080/home/DEV/xsd/lexikon.xsd',
    schemadoc=>sys.UriFactory.getUri('/home/DEV/xsd/lexikon.xsd'));
    END;
    The following error-message is displayed:
    ERROR at line 1:
    ORA-31000: Resource 'metadata.xsd' is not an XDB schema document
    ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 0
    ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 166
    ORA-06512: at line 2
    I made the XSD-Files by XMLSpy. The Documents are well-formated and valid.
    When i make a new XML-File based ONLY (of course) on lexikon.xsd everything works fine with XMLSpy.
    How must i register these documents? Is it possible? Or can´t i register XSD-Files which includes others?
    Thank you very much
    cu
    Heidi

    Heidi,
    register the metadata.xsd first inthe same way and then register the lixikon.xsd.
    it should work.

  • Certain files which need to be reinstalled by oracle universal installer

    I am applying patch and getting error......
    10g Release 2 (10.2.0.4) Patch Set 3 for Microsoft Windows (32-Bit) on 10.2.0.1.0.
    ERROR:
    Certain files which need to be reinstalled by oracle universal installer
    are being used by one or more running services'. It contains a list of 30 services. All oracle services are already shutdown.
    I have stopped all Oracle services, set it to manual, and restarted the system...but am getting the same error again...
    I am trying it since yesterday...but really tired of this error. what could be the reason...
    please help

    I have got some options please check it.
    LIVE DB Name - ERP
    TESTDB Name - TEST
    1. Should I create another home/database TEST
    1.1 apply patch on it and then uprgrade it.
    1.2 Restore the cold backup of ERP database on it.
    OR
    2. Should I create another home/database TEST
    1.1 Restore the cold backup of ERP database on it.
    1.2 apply patch on it and then uprgrade it.

  • I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it show

    I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it shows in LR under folders as the F drive and the little green light is on, but LR is showing only the first 6 files and not the remaining 200 or so. How do I expand the F folder to expose all files?

    I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it shows in LR under folders as the F drive and the little green light is on, but LR is showing only the first 6 files and not the remaining 200 or so. How do I expand the F folder to expose all files?

  • Hi, I am getting an 'Error 4810 occurred at Sound File Read Open.vi' for the attached wav file (plus many other wav files). Any ideas?

    Hi,
    I am getting an 'Error 4810 occurred at Sound File Read Open.vi' for the attached wav file (plus many other wav files).
    Any ideas?

    No attachment exists.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to run a compiled file that needs a jar

    Hi all
    I'm trying to run a file that I've compiled that requires a jar
    I have both the jar and java file in the same directory
    HelloWorld.java
    itext.jar
    i compile using
    javac -cp itext.jar HelloWorld.java
    which produces my HelloWorld.class
    but when i run
    java HelloWorld
    I get loads of errors
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorl
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Sourc
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    am i doing something wrong with trying to run the class with the jar file?

    Didnt work
    C:\Projects\pdf>java -cp .;itext.jar HelloWorld
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong name: com/lowagie/examples/general/HelloWorld)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)

  • How to run sqlj.exe to translator Sqlj file which depends other file

    I want to use sqlj.exe to compile sqlj file. I don't know what option can be set for Sqlj.exe can automatically compile sqlj file and it's dependent file(sqlj or java).
    Here is one case:
    There are three six files.
    p1\A.sqlj
    p1\A1.sqlj
    p2\B.sqlj
    p3\C.java
    p3\DI.java
    p4\E.java
    1.the Class A has been declared as follow:
    public class A extends C implements DI{
    And in A.sqlj file, Class B and A1 will be used.
    2.the class E has been declared as follow:
    public class E extends C{
    I want run sqlj.exe as follow:
    sqlj -d=. A.sqlj
    Does it can auto compile C.java, DI.java and A1.sqlj, B.sqlj?
    We known, when java file is compiled, the dependent java file will be auto compiled,
    for example, the command,
    javac E.java
    will compile E.java and C.java.
    But how sqlj.exe automatically compile dependent file.
    Thanks,

    I want to run an exe file Runtime.exec()
    installed in a server from a client machine Server program that executes Runtime.exec() if told to do so by a client via a socket connection
    everyday at a particular (fixed) time.Look at System.currentTimeMillis(), Calendar, Date, Timer...

  • Through Java code I want to execute a exe file which is in aJar file

    I am having some classes and an exe file in a directory. I have made them in to a Jar file. In a class file which is in that jar file i want to execute a Exe file which is also resides in that jar file. Is it possible to exexute that EXE file?
    For Example....
    1. Im having a directory named CLIENT.
    2. In that directory I have 10 clss files and an EXE file.
    3. These class files and EXE files are ziped in to a Jar file.
    4. I have to give the Jar file to my client.
    5. He can put that Jar file where ever he installed my product may be C driver or D drive like that
    Now the problem is...
    I want to execute the Exe File from one of the class where both the exe file and class file resides in the Jar file
    This is my requirment
    Can anyone Help to me to solve this problem?
    Thanks in Advancd
    Ibram Shah.A.M
    ([email protected])

    The answer is to extract the EXE into a temp directory, execute it, and delete it when you're done. For example:
    //This is the path *inside* the JAR file!
    InputStream in = getClass().getResourceAsStream("/resources/myprog.exe");
    OutputStream out = new FileOutputStream("myprog.exe");
    File file = new File("myprog.exe");
    int data;
    while((data = in.read()) >= 0) out.write(data);
    in.close();
    out.close();
    //Execute the EXE here using java.lang.Runtime.exec()
    if(file.exists()) file.delete();
    ...

  • How to call Fortran .dll file that using other library files?

    Hi,
    I am trying to do some arkward tasks using LabView, and I am desperately need help....
     A little bit background:
    1. My co-worker has some code written in Fortran, where he called other libraries (many from CERNLAB or PAW). Those stuffs are pretty powerful in mathmatical calculation and simulations.
    2. In some of my LabView code, I need to call his Fortran source code in order to do some complicated calculations. I have no capablility to translate his Fortran code to Labview (or is it even possible??), so we end up with trying to use "Call library function node" where I just provide input/outputs to communicate with his code. The idea sounds simple enough?
    3. We complie the Fortran code into .dll, and then specifiy the dll in "Call library function node". The first try with a very simple Fortran code, something like c = a+b*a, was sucessful. The dll file and Call lib function worked good. It's sort of proved the concept.
    4. Now I am trying more complicated Fortran code (say Test.dll), which calling other library (.lib files) that using typical "call xxx(a,b,c)" line, and my nightmare started....  It seems nothing was excuted when I call Test.dll in LabView.
    Questions:
    1. How do LabView know if the Test.dll code needs functions from other .lib files? Do I need to copy all the .lib files to a specific folder?
    2. When I create .dll file, for LabView to be able to use it, are there any special requirement on the way the .dll is compiled?
    3. Seems there is mismatch btw the data type in Fortran and LabView. For example, LabView's  Signed 8-bit Integer seems different with a integer in Fortran. How can i know the correlation btw data type in different langurage, i.e. LabView vs Fortran?
    4. Are there any good examples that I can take a look?
    I would highly appreicate any suggestions/helps!
    Rgds,
    Harry

    You are aware that Intel Visual Fortran is the successor to Compaq Visual Fortran (I think you made a mistype with the Virtual)? So an upgrade might be at its place.
    Anyhow I'm really not familiar with Fortran at all, but lib files are usually compiled into an EXE or DLL and not loaded dynamically. 1) 
    So there should be no problem with locating those libs. What most likely is a problem are other DLL dependencies such as any Fortran Runtime library or possibly other third party DLLs the more advanced code in your DLL might be using.
    Typically most compilers can be configured to link the runtime library code statically into the DLL, as altenbach reports for the Intel compiler, otherwise you must make sure to install the  redistributable Fortran Runtime Library for your compiler. Besides that you must make sure to find out what other runtime dependencies your code might have and install them.
    1) One exception I know of is LabWindows CVI which allows to also load lib files dynamically. This is supposedly a legacy feature from LabWindows for DOS, which allowed that feature to simulate dynamic module loading in order to swap modules at runtime to work around the 640k memory limitation of DOS.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Safari (Snow Leopard) will not link to website (pdf) files from within other pdf files

    Meeting agendas (in pdf format) have 'web links' to other pdf files, but Safari says not enough info in the webaddress.  But it works O.K. in Windows Explorer.

    Open browser preferences
    ex Safari>Preferences>Extentions   and un-enable any ext that mabe interferring , ex divX
    or open Help> installed Plug-ins and remove Adobe Acrobat.
    if still a problem
    Quit Safari.
    In the Finder, select Go ▹ Go to Folder from the menu bar, copy the text on the line below into the box that opens, and press return:
    ~/Library/Preferences/com.apple.Safari.plist
    A Finder window will open with an item selected. Move the selected item to the Desktop, leaving the window open.
    Launch Safari and test. Its settings will have reverted to what they were they first time you launched it. If it works as expected, recreate the settings and delete the item you moved to the Desktop. Otherwise, quit Safari again and put the file you moved back where it was, overwriting the newer one created in its place.

  • LSMW: error when import source file which contains other language character

    When I use LSMW to import master data,
    on the step,"Specify Files",there are
    two choice for code page,"ASCII" "IBM DOC",
    but neither of them can work correctly,
    both cause chaotic code.
    for example "#ãb####&#1378;##"

    Hi Colin!
    I'm working with English and Cyrillic input files. As long as I don't use English file for the Russian application, all works well.
    I figured out two important points:
    - Log-in in 'target' language. This has to set locale and language defaults -> LSMW will asume correct codepage (when your system has correct default settings).
    - Save your text file with correct codepage. With MS Word or MS Excel I haven't seen detailed options, but with OpenOffice  you can set codepage when saving files with '*.csv'-filter.
    Regards,
    Christian

  • Linking a common Pages file to several other Pages files

    I have a common section called "Terms and Conditions" that is used in several different documents. If I change the "Terms and Conditions" I have to edit every file that contains that section. Is there a way to "Link" a seperate "Terms and Conditions" file to each document that contains that section, therfore editing only a single file and each document gets updataed automatically?

    Hi emarino,
    You can create a link between Pages documents. It will only serve to open the other document; it won't automatically update the content. You will have to copy the revised Terms and Conditions and paste them into each document.
    Or, just leave it as a link for the user to follow to the revised Terms and Conditions document:
    Page 112 of the Pages User Guide: Linking to Another Pages Document.
    Download the Guide from the Help Menu in Pages.
    Regards,
    Ian.

  • Question about having a master sql scrpit/file that calls other sql files

    I know that in SQL Plus, the following works:
    master.sql:
    @script1.sql
    @script2.sql
    @scriptn.sql
    My problem is, I'm using the sql maven plugin and the jdbc driver doesn't seem to like the @script.sql syntax. So the question is two-fold. Is it possible to get this master script behavior using the jdbc driver and not SQL Plus. Second, is the @script.sql syntax, specific to SQL Plus?
    Thanks!
    Justin

    The @<<script>> syntax is specific to SQL*Plus. I'm not familiar with the "sql maven plugin", so I have no idea whether it has some analogous syntax for calling scripts in other files or not. The JDBC API works just with SQL statements, not scripts, so whatever application (I'm guessing SQL Maven?) that is using the JDBC driver has to interpret the @<<script>> syntax.
    Justin

  • How to execute a jar file which has an applet, without using a html file ?

    I have a jar file which contains a set of class files. iam able to execute the jar file by using this html code
    <html>
    <applet code="file.class" archive="file.jar" width="500" height="300">
    <param name="name" value="value">
    </applet>
    </html>
    I want to know how to execute this class file without using the html tags.
    pls help me out in this.
    Anki

    Hi,
    You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
    1. Open a notepad and write the following
    Main-Class: XXXXXXXX
    XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
    2. Save the file as Mani.mf
    3. In the commant prompt ( your directory ) type following lines.
    jar cmf Mani.mf Demo.jar *.*
    4. This will make a jar file which is executable jar file
    Hope this will help you.
    Deepak

Maybe you are looking for

  • Camera Raw - Enable RGB Tone Curves

    In Camera Raw, the Tone Curve Channel selection is disabled.  How can I enable it to allow me to adjust specific colors in Camera Raw? I'm using Photoshop CS5, Camera Raw version 6.7.0.339 on a Windows Vista 64 bit system, and my camera is a Nikon D9

  • My i pod screen is white

    my ipod screen has been white all day it previously did this before but fixed itself and now it wont . how can i fix it without using my home button because my home button is stuck

  • How to set my own Ranges in Charts

    Hi- I've just started playing with making charts in Numbers. When I select some cells and then ask Numbers to produce a chart it does so and sets it's own values for the Y-Axis. How can I set MY OWN values for the upper and lower limits (ie. 0 at the

  • Delaying start of movie

    I have a short movie that I want to load normally, without the play controller being visible, and then for it so start to play automatically, but not until about 5/10 sec or so after the page has opened. Can't seem to find a neat way of doing it. Any

  • Post production support Issues

    Gurus, Can anyone provide me with PA/OM production support issues with the solutions..will be obliged Regards Eliz