Can I store a jar in a jar

I have a program that I want to use from the command line. I would like to store a db driver (opta2000) which is in a jar, in the jar I am storing the rest of the classes in. That way I can call it and my classes will be able to find it. As it is now I have it listed in my classpath on my machine but when running my program from a jar it can't find it. If I do not store my classes in a jar the opta2000 driver is found.
Thoughts?

That's one way. There is another:
If you use a manifest when you create your applet jar file, you can add a Class-Path: entry in it which lists all the jars your applet refers to.
Example: Class-Path: jar1.jar jar2.jar jar3.jar
So long as both jars are in the same directory, the other will be found just fine.

Similar Messages

  • Can I store .txt files in a jar and read them?

    I have searched the forum and didn't find exactly what I needed.
    I have multiple .txt files that will most likely not change over time. I have a class that reads them as needed. I need to do this in a jar file but can not seem to read the .txt files.
    Any help?

    You should be able to read them using an idiom like this:
    URL textURL = MyClass.class.getResource("res/txt/TextResourceFile.txt");where MyClass is the name of a class, and the specified path is relative to the location of that class.
    I haven't actually tried this for text files, but I do use it to load images, so it ought to work for this too.

  • Can anyone explain how they made this Jar file

    Hi all,
    I have searched the forum without luck. Lots of people asked questions about protecting their jar files but almost everyone said to either use exe file or use obfuscators.
    But how can I make my jar so it is not possible to open it or when you try to open it you get nothing.
    For eg. jar -tvf myjar.jar returns nothing and no error message.
    I am also going to go one step ahead and give you an example of such a jar file you can download from the net to check it out yourself what I mean.
    Go to the following site and download the exe file by clicking on the download cluster link
    http://support.novell.com/servlet/filedownload/pub/drsapuserir1.exe
    Open command prompt run the exe....accept the license and it should extract couple of files one of which is a jar file called sapusershim.jar
    Try to open it with winrar, winzip or jar utility. You won't be able to. But I know for sure the jar is not corrupted because I use it in my application at work. This is not the only example of such jar file I have experienced.
    So now we all know it's possible. But I would really like to know how.
    Regards,
    Hiten.

    By definition, if the jar utility program won't operate correctly on the jar, it is corrupted in some manner and no longer standard.

  • Who can tell me about the usage of jar -m ?

    Hi!
    When I try to add my Manifest.mf to my .jar file , use :
    jar -cvfm mytest.jar Manifest.mf -C camon/test/ test.class
    but the result is a error :
      java.io.FileNotFoundException: Manifest (The system cannot find the file specifi
       ed)
            at java.io.FileInputStream.open(Native Method)
            at java.io.FileInputStream.<init>(FileInputStream.java:64)
            at sun.tools.jar.Main.run(Main.java:124)
            at sun.tools.jar.Main.main(Main.java:904)
    my Manifest.mf is like following :
        Manifest-Version: 1.0
        Name: "Camon Test for Manifest"
        Main-Class: camon.test.Test
        Created-By: 1.3.1_01 (Sun Microsystems Inc.)
    Any help is appreciated!!

    Yes , it can work normally ,but you can't access your Manifest.mf when you java -jar mytest.jar , I get the way now :
    1 . Create folder meta-inf ,and copy Manifest.mf here;
    2 . use this command :
    jar -cvfm mytest.jar meta-inf/Menifest.mf -C camon/test/ Test.class
    3 . then ,you can run a .jar with :(of course you will init the Main- Class)
    java -jar mytest.jar

  • Can't get matching xdb6.jar, xmlparserv2.jar and ojdbc6.jar

    No matter what I try, they are always somewhat different and I'm getting exceptions with JDBC on either setSQLXML or on .getString() once I retrieved the SQLXML object and want to get the content back or I'm downright getting "oracle.xdb.XMLType cannot be cast to java.sql.SQLXML"
    How is it possible that Oracle who owns Java and OracleDB can't make a working Java driver? I just want to be able to work with XML, I didn't know this was asking much. I have OracleXE installed.

    Welcome to the forum!
    Whenever you post you need to provide ALL of the product and version information applicable to the question or issue you are asking about
    >
    No matter what I try, they are always somewhat different and I'm getting exceptions with JDBC on either setSQLXML or on .getString() once I retrieved the SQLXML object and want to get the content back or I'm downright getting "oracle.xdb.XMLType cannot be cast to java.sql.SQLXML"
    >
    Before you submit a question or issue use the 'Preview' tab so you can see it as it will display. Then read your entire submission and ask yourself:
    >
    Could I answer a question like that based ONLY on the information that was provided?
    >
    For this thread the answer would be NO!
    All you have done is complain. That is basically the equivalent of a five year old saying 'Mommy, my tummy hurts'.
    >
    No matter what I try
    >
    What did you try? You haven't posted ANY information about what you are even doing, what jars, tools or code you are doing it with or HOW you are doing it.
    >
    I'm getting exceptions with JDBC on either setSQLXML or on .getString() once I retrieved the SQLXML object
    >
    What exceptions? You haven't posted ANY exceptions or any of the code that caused those exceptions.
    Retrieved WHAT SQLXML object? Retrieved from where? What is the full name and version of the database you are using? For Oracle that would be the 4 digit version as returned by 'SELECT * FROM V$VERSION'. Oracle DB doesn't have any SQLXML objects; it has XMLTYPE columns. Is that what you are trying to access?
    >
    Can't get matching xdb6.jar, xmlparserv2.jar and ojdbc6.jar
    >
    Where did you get them from? How did you get them? How do you know that they don't match? What is the full name and version of the jars that you are using?
    Have you used this functionality before? Do you know how to use it? If you have never used it and have no expertise with it we need to know that so we can tell you how to get up to speed so you can use it successfully.
    Since you haven't provided ANY of the information needed to provide any specific suggestions all we can do is assume that you are using the last, current version of Java and all jars files and have never used the functionality. In that case you need to start at the beginning.
    Review the relevant sections of the JDBC Developer's Guide
    http://docs.oracle.com/cd/E18283_01/java.112/e16548/jdbcvers.htm#BABGHBCC
    >
    SQLXML Type
    One of the most important updates in JDBC 4.0 standard is the support for the XML data type, defined by the SQL 2003 standard. Now JDBC offers a mapping interface to support the SQL/XML database data type, that is, java.sql.SQLXML. This new JDBC interface defines Java native bindings for XML, thus making handling of any database XML data easier and more efficient.
    The oracle.jdbc.getObjectReturnsXMLType Property
    In Oracle Database 10g and earlier versions of Oracle Database 11g, Oracle JDBC drivers supported the Oracle SQL XML type (XMLType) through an Oracle proprietary extension. XML values were represented by instances of the oracle.xdb.XMLType class and the SQL XMLType values were read and set through the JDBC standard getObject, setObject, and updateObject methods.
    The JDBC standard requires the getObject method to return an instance of java.sql.SQLXML type when called on a SQL XML type column. But, the earlier versions of Oracle JDBC drivers return an instance of oracle.xdb.XMLType. This does not conform to the JDBC standard.
    The current release of Oracle JDBC drivers conform to the JDBC standard with the introduction of a new connection property, oracle.jdbc.getObjectReturnsXMLType. If you set this property to false, then the getObject method returns an instance of java.sql.SQLXML type. You can achieve this by using the following command line option while compiling your program with javac:
    -Doracle.jdbc.getObjectReturnsXMLType="false"
    If you depend on the existing Oracle proprietary support for SQL XMLType using oracle.xdb.XMLType, then you can change the value of this property back to true by using the following command line option:
    -Doracle.jdbc.getObjectReturnsXMLType="true"
    The value of the oracle.jdbc.getObjectReturnsXMLType property is a String representing a boolean value of either true or false. If the value of this property is true, then the getObject method returns oracle.xdb.XMLType instances, when called for a SQL XMLType column. This is the deafault value of the oracle.jdbc.getObjectReturnsXMLType property. If the value of this property is false, then the getObject method returns java.sql.SQLXML instances. This is the standard JDBC-compliant mode.
    Note:
    The oracle.jdbc.getObjectReturnsXMLType property affects only the result of the getObject method. All other methods conform to the JDBC 4.0 standard regardless of the value of the property.
    >
    The exception that you are getting
    >
    oracle.xdb.XMLType cannot be cast to java.sql.SQLXML
    >
    is telling that the XMLType is NOT an SQLXML type so you can't use it as one. That doc section above should tell explain that those are two DIFFERENT types. You use one or the other depending on which version of the functionality you want to use. You can use the older 'non-JDBC' standard or the new 'JDBC' standard. But you can't mix the two.
    Review that entire chapter of the doc and see if that helps.
    If not then you need to provide ALL relevant information if you need more help:
    1. Java version
    2. DB name and version
    3. JAR file names and versions
    4. Java code that demonstrates the problem
    5. EXACT copies of any and all exceptions and errors that occur
    6. A description, in English, of what you are trying to do and how you are trying to do it.
    When you post use \ on the line before and on the line after any code to preserve formattting. See the FAQ for other formatting guidelines. Use the 'Preview' tab to see what your post will look like before you submit it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Where can I get deploytool_patch.jar and cmp_patch.jar?

    Please help me!
    Where can I get deploytool_patch.jar and cmp_patch.jar?

    Try this link:
    http://www.iplanet.com/ias_deitel/installation-deploytool/iPlanetReadme.html
    and there especially:
    http://www.iplanet.com/ias_deitel/installation-deploytool/patches.zip
    Kind regards,
    Jakob

  • Where can i download the util.jar and base.jar File?

    Hi all,
    in some SAP-Notes are describe where i can download these Files.
    For Example:
    http://service.sap.com/netweaver
    SAP NetWeaver
    -> SAP Netweaver in Detail
        -> Application Platform
           -> DB and OS abstraction
              -> Platforms
                 -> Platform specific information
                    -> Microsoft      
    x SQL Server
    ZIP-File: "JDBC Driver for MS SQL Server"
    But there are no ZIP-File !!!
    Can anyone tell me where i can find the base.jar and util.jar File?

    Hi Christian,
    when using a vendor's JDBC drivers, you must go to the vendor to get them. For Microsoft here is a good place to start: http://www.microsoft.com/sql/downloads/
    These JDBC files should also be included with you SQL Server CDs...
    Hope this helps!
    Cheers,
    Jeff

  • Can't find jcert.jar, jnet.jar, and jsse.jar

    I am trying to implement SSL in Tomcat (1.4.18 I think). I have already installed j2sdk1.4.1_01 which is supposed to contain thise files, but I can't find them.
    Does anybody know why this might be happening?

    If you are using j2sdk1.4.1, only jsse.jar exist the rest of it does not. Check the jre folder in your java_home folder and you will see jsse.jar. Copy the jsse.jar and paste it into java_home/jre/lib/ext. after that you can continue with your SSL configuration. I tried it and works fine even without the jnet.jar and jcert.jar. I had the same problem as you when I was configuring SSL on my resin webserver. the documentation for installing jsse may only be applicable to java version jdk1.3 and below.

  • How can I make my source code with jar file?

    I use JDK1.6.0. I can open a class file from rt.jar and get its source code. Does this because open source JDK? I wander how I can make my jar file with source code.

    CeciNEstPasUnProgrammeur wrote:
    youhaodiyi wrote:
    But why I can read source code from rt.jar? I found there are only class files in it.I say it's highly likely that you can't and your IDE's settings rather automatically refer to the src.zip file in the JDK's directory.I see. That's true. I use eclipse as the source code reader. It may refer to the source code zip file automatically.
    Thanks all.

  • Where can I find the javadocs for HTTPClient.jar

    Hi,
    Where can I find the javadocs for HTTPClient.jar shipped with the WLP4.0.
    Does this support https?
    Thanks
    Dalia

    In the API Reference we can get the Java Docs for the classes you looking for.
    As per previous post the reference link is http://download.oracle.com/docs/cd/E22630_01/Platform.1002/apidoc/index.html

  • How can change ojdbc14 jar to ojdbc15.jar orcale As and weblogic server

    On the machine I installed the server, Oracle JDBC drivers are in ORACLE_HOME/jdbc/lib/ojdbc14.jar.
    How can change Oracle JDBC drivers ojdbc14 jar to ojdbc15.jar.

    >
    On the machine I installed the server, Oracle JDBC drivers are in ORACLE_HOME/jdbc/lib/ojdbc14.jar.
    How can change Oracle JDBC drivers ojdbc14 jar to ojdbc15.jar.
    >
    You can't - do not attempt to or you may break Oracle.
    The JVM is an integral part of Oracle and without the proper, certified version of the JVM the database will not run properly. In fact if you use Oracle installer and elect to remove the JVM the database itself will be removed also.
    Oracle 11g installs with JDK 1.5 and that is the ONLY version that is certified to work properly with 11g. If you attempt to use any other version you are violating your support contract and will likely have errors.
    The installed version of the JDK is the version that Oracle itself uses and is the version that will be used for any Java classes that you load into the database and run from within Oracle.
    You are free to use any version of the JDK you want for external Java applications.

  • Can i have two main in a jar

    I have an application with two differents programs, so i have two main in one jar.
    My manifest file :
    Manifest-Version: 1.0
    Main-Class: Interface.Interface_Lancement
    is it possible to launch my other main() from Interface.Interface_Lancement2 class or must i have another .jar with this manifest file :
    Manifest-Version: 1.0
    Main-Class: Interface.Interface_Lancement2
    I would only have on .jar but switch between two different main.
    Thx a lot.

    Maybe I'm missing something, but how's the jar file supposed to know which main you want to run? I would think instead, you may want to have one main that queries the user for which app they want to run, and then run the appropriate app, or have two jar, one for each app. If they share a lot of code, you could have three jars (app1.ja, app2.jar, and shared.jar) and add shared.jar to both their classpathes.
    hth,
    m

  • Third party dlls and jars with in jars.

    Hi,
    I have a application which uses several 3rd party jars and dlls.I want to create a executable jar for the application .I added the external jars using fat jar eclipse plugin. Iam able to run the jar on my system successfully.But on other systems the application doesnot launch as the dlls are not avaiable which is fairly understandable. It gives the following exception 'JarClassLoader: Warning: Unable to load native library: java.lang.NullPointerException'.Now i need to include these dlls into the jar so that i can distribute the application as a single jar and launch double clicking it.I know expecting dlls ignores the cross platform nature of java but i need it.please give me some idea on how this can be done.
    Thanks in advance

    Hi,
    I have a application which uses several 3rd party jars and dlls.I want to create a executable jar for the application .I added the external jars using fat jar eclipse plugin. Iam able to run the jar on my system successfully.But on other systems the application doesnot launch as the dlls are not avaiable which is fairly understandable. It gives the following exception 'JarClassLoader: Warning: Unable to load native library: java.lang.NullPointerException'.Now i need to include these dlls into the jar so that i can distribute the application as a single jar and launch double clicking it.I know expecting dlls ignores the cross platform nature of java but i need it.please give me some idea on how this can be done.
    Thanks in advance

  • Including web service jaras in final jar file

    Hello all.
    Im using netbeans 4.0. I have used JAXB code in my program, ie. Ive used a few packages I created with the XJC compiler so i can unmarshall some XML documents. I have included the four JAXB Jar files from the Java Web Services Developer Pack in my project by including them in the projects "Classpath for compiling sources". This works fine when running in netbeans. But when I try running the project outside netbeans by double clicking on the generated JAR file I get a
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    Im guessing this is because it can't see the jaxb jar files when not run from within netbeans. How would I include the jaxb jars in the jar file that netbeans generates?
    I know this is partly an IDE related question but I thought it must be a fairly common problem when creating JAR files so i posted it here.
    Any help is appreciated.
    thanks

    Im guessing this is because it can't see the jaxb jar
    files when not run from within netbeans. How would I
    include the jaxb jars in the jar file that netbeans
    generates? You wouldn't include them in that jar file. You would include Class-Path entries (which refer to the jaxb jars) in the manifest of the jar file that Netbeans creates.
    Don't ask me how to do that, I don't use Netbeans. I assume that Netbeans must support it somehow, but if you can't find out how then a Netbeans forum would be a good place to ask.
    I know this is partly an IDE related question but I
    thought it must be a fairly common problem when
    creating JAR files so i posted it here.

  • Standard.jar and jstl.jar directory

    First off I probably should apologize in advance because my problem might be an eclipse config issue.
    I created a simple servlet and I tried to include a jstl library import javax.servlet.jsp.jstl.sql.Result;. It compiled cleanly but, when I ran the application (through a browser accessing tomcat through eclipse) I was getting this error...
    The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    I eventually found out what was wrong but I don't understand why it was wrong and that's my question. Originally I had jstl.jar and standard.jar in the projectHome/lib directory. When I moved those 2 files to the projectHome]/WEB-INF/lib directory, however, things ran correctly. Is this a setting somewhere within my tomcat config on eclipse perhaps? Or can someone point me in the right direction about this issue in general?
    Thanks in advance!

    Tomcat and Eclipse have different ideas of classpath.
    In Eclipse you set the classpath as part of the project properties: Java Build Path.
    Tomcat uses:
    - web-inf/classes directory
    - jar files in web-inf/lib
    - jar files in /shared/lib
    - jar files in /common/lib
    So in order to run on Tomcat, they need to be in the web-inf/lib directory.
    Cheers,
    evnafets

Maybe you are looking for

  • Multiple Forms need to be generated

    Hi Friends, I have a requirement to issue the Smartfrom for each material in the delivery(I will display some characterstics of each material as a form). This would be called from VL02N through configuration. I have written a driver program and i am

  • Has Apple come up with a fix for Parental Controls?

    I've browsed around on this forum quite a bit but haven't seen any real fix for the fact that Parental Controls does not work as advertised (come to think of it, it doesn't work at all). Is there a fix?? I'm using a new iMac with 10.5.2 (clean instal

  • Defining and using new listener insted of the current one

    Dear my database suddenly become not working and when i open oracle EM i found it down because of the listener is down and i foun the port number is 1521 while my creation of the data base the port that i used was 1525,so, How can I manually create a

  • Pro-Rated Tethering Charges

    I don't need tethering often enough to justify the extra cost of DataPro with Tethering vs the standard DataPro plan on AT&T. However, it is sometimes nice to have when traveling. Is it possible for me to switch to the tethering plan only for the day

  • Single click event in alv grid.

    Hi Experts, i have done will my code..everything is working perfectly, but having an issue..pls help me... in my output screen i have 2 check-boxes,when i select both of them i shuld get a message saying select only one..this is done when am using do