Calling jar -xvf

Hi - I am trying to unjar a jar file by calling the jar command "jar -xvf". My code is calling the jar command but is not unjaring the jar file. This is my code:
try{
Runtime r = Runtime.getRuntime();
Process p = r.exec("jar -xvf " + jardirectory + jarfile);
}catch(Exception e){System.out.println(e);}
Why is it not unjarring the Jar file? The only way I got it to unjar by calling a batch file that calls the jar command. I really want to unjar the file through Java, and not through a batch file. Thank you.
Seigot

see documentation for java.util.jar.* , esp. java.util.jar.JarFile

Similar Messages

  • Call *.jar inside the trigger (MS SQL)

    Hi!
    I'm just looking around google and can't find any good news.. The problem is: how to call *.jar inside the trigger. Trigger is stored in M$ Server.
    Tnx, if any response! ;)

    What?

  • Jar -xvf file.war doesn't overwrite all files.

    Has anyone else experienced the case when a WAR file created using Netbeans is extracted (jar -xvf file.war) doesn't overwrite all the existing files in the directory with the files contained in the WAR?

    Looks like it doesn't always do it or I extracted the war file in another directory and then issued the mv command to move the tree thinking it would replace all files.

  • Jar calling jar

    what is the magic line that I have to add to my jar application in order to call another jar program ???
    Regards Amnon

    Do as #4 said to call main method directly ('main' of whatever class would be called from the jar).
    Or, you'd have to use Runtime.getRuntime().exec(...), where the "..." is the same "java -jar ..." command you would run from the command line (note that there are several overloads of exec, depending on what you need--check the API).
    And, read the standard advice for using Runtime.getRuntime().exec :
    When Runtime.exec() won't:
    Navigate yourself around pitfalls related to the Runtime.exec() method
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • Calling jar file from jsp - serious problem !

    Hi there, I'm trying to call a jar from a jsp file. I need an import clause in my jsp, to the class I want to use.
    I'm using eclipse, and while i"m writing "<%= " and the begining of my class name , he autocompletes it and automatically puts an import of my class in the top of the html. It is very convenient , but the problem is that he underling the class name (in the impot: <%@page import="myClass"%>), and I get "The import myClass cannot be resolved" error.
    I got an advice to put my class in a package, since it was in a default package. I did it. But now I have 2 problems:
    1. I can't run my jar in command window: java - jar myJar.jar. in gives me: Exception in thread "main" java.lang.NoClassDefFoundError....
    2. I still get an error - "The import myClass cannot be resolved" in the jsp, although I threw the old jar (that his class I want to use was out of package), and brought a new jar after creating it.
    I hope I managed to clarify myself. I'll be thankful of any help !!!

    Hi MSoldier.
    There are two ways to do this:
    1) You use the java.lang.Runtime classes to start the java application in your JAR file, just like you would have done it from the command line. The Runtime class has three different exec() methods that can be used to run any program just like you would from the command line. Remember, using this method you will have to write everything just like if you run your Java application from the command line, incl. classpath etc. This way your Java application will be run as a separate process. When the application finishes the process is shutdown and the resources (RAM etc.) taken by it freed, just like when you shutdown any other application.
    2) You can open the JAR file yourself from inside the JSP page, look inside the META-INF file to find the main class, and then calls the main class main method. There is an example of how to do this in the Java Tutorial available from Sun under the JAR files track. Check these links :
    The Java Tutorial at Sun
    http://java.sun.com/docs/books/tutorial/
    The JAR File Tutorial at Sun
    http://java.sun.com/docs/books/tutorial/jar/index.html
    Opening JAR Files via the Java JAR File API
    http://java.sun.com/docs/books/tutorial/jar/api/index.html
    Note however, if you have just created some classes that you want to use from inside your JSP pages, and not a separate application that needs to be run separately, you should just include the JAR file with your custom classes inside the WEB-INF/lib directory. These classes are then automatically available to your JSP pages, just like the rest of the Java API.
    I hope this answers your questions,
    Kind Regards,
    Jakob Jenkov
    Software Architect
    Jenkov Development
    www.jenkov.com

  • Call .jar in ANE for Android

    Hi everybody, can you tell us what is the way for this?:
    "We are building a new ane, that ane needs to call an external .jar"
    When we build Android apk works, however when we try to invoke inside of the .jar for the ane doesn't work.
    Let me make clear: ex.  ane->.jar->external .jar
    Thanks for your help.

    Hi,
    I think the problem here is actually something to do with the way AIR is packaging the assets. I've been investigating the issue trying to get access to video files packaged in an AIR app from an ANE but they are sometimes compressed in the APK rather than just being stored. Once they are compressed you get the error you've encountered:
    java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
    I think this has to be an error in the AIR packaging, as they shouldn't be compressed. Any files like mp3, mp4, png etc shouldn't be compressed according to the Android packager.

  • Stored procedure calling jar

    Hi everyone, is possible to load some jar into oracle and it be called by a stored procedure?
    Thanks.

    Hi,
    Can you elaborate more on how/why you invoke a Jar?
    As of 10g, you can load a Jar as is as a resource object or explode it to refer to individual classes part of it.
    Kuassi http://db360.blogspot.com

  • Calling JAR inside WAR

    Dear experts,
    I hope this is the right place to post such question. I have a web and desktop app developed using netbeans and to be built into a JAR(J) and WAR (W) file. I would like to know if it is possible for the (J) to call some other JAR (or .class) inside the (W)? Our ultimate goal is to share common classes between two apps, and hopefully no need to re-build the (J) when (W) is modified, or vice-versa. I hope my explaination is clear enough. Any comments and sugguestions is welcomed and appreciated, thanks.

    Remember that whatever servlet container (appserver) that you are using does not actually execute a WAR file but deploys its contents to a particular location.
    The contents can be JAR's, classes, images, whatever, but you need to specifiy in the classpath the JARs and class files that you wish to use.
    It is always a good idea though to rebuild the WAR file if you make a change to a JAR file that is contained in that WAR file. It should be rebuilt and redeployed.
    It is not good to manually change Jar files after the WAR is deployed.

  • Calling jar inside dll methods

    Hello,
    Can anyone give me a brief explanation on how to use the methods of a dll (made on c++) from java?
    I would like to put the dll inside the jar/cab file along with the java classes.
    best regards
    Jonathan

    Thank you, I checked the links which are were very instructional.
    But I have one question remaining: How can I make reference to a dll inside my jar/cab file?
    the line System.loadLibrary("xxx") load just dlls from the local machine?
    best regards
    Jonathan

  • How to call a jar file from oracle forms (6i)

    Hi,
    I'm working with oracle 6i. I want to know that how to call a .jar file from forms menu. when I use HOST('<path>\test.jar') it is working in 'Client Server' any way. but the problem is I use application server in order to run my form. so my form is in the server and I run the form via clients web browser. in that case above solution will not work. if any body knows how to overcome this problem please reply.
    thanks.
    duminda

    I created a bean area and set the class name as implementation class. within that java bean class I called to a bat file which consists of the execution command of the jar file ( because i don't know how to call .jar file from my bean class directly).
    then i tried to run it in application server. its still not running.
    can you tell me what i have to do within my bean class? or can you suggest any solution?
    thank you.

  • How to Call third party Jar into Application

    Hi Can any Expert help ?
    I want to put third party Jar into my application but i have some problem occur.
    1. how to call jar with parameter in application ?
    2. when i exit the third party jar task, it will exit my main task too. How to set my main tast exit stats standalone ?
    3. I have over 10 jar files in one application, how can i set a classpath for client to call JNLP, instread of load all jar to client before run.
    Thanks.
    Sanki Poon ([email protected])

    1) Sounds like you are trying to launch the third party from it's application main instead of using it as an API How does your code interact with it or is that not important?. You don't call a jar, you load a class. You could use a exec http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html to run the java launcher and pass it all it's command line stuff(But this may not be possible security wise via WebStart).
    2) if it is launched in the same JVM and it calls a System.exit there is nothing you can do about your app closing too. It would need to be in another instance of the JVM
    3) Under the resources tag you can have as many jar tags as needed.
        <resources>
            <j2se version="1.5.0" java-vm-args="-esa -Xnoclassgc"/>
            <jar href="/jsf-wita/apps/MathMLWebEditor.jar"/>
        </resources>

  • Jar file - files with execute permissions (Unix)

    I want to jar up a bunch of files. These files have execute permissions.
    When I jar it up
    jar -cvf myjar.jar <list of files>
    Then I do
    jar -xvf myjar.jar
    It extracts the files, but the files loose the execute permissions.
    How can I keep the same permissions? Is there an option in the jar command that will allow me to do that?

    "execute" one of the .class files on a UNIX (or
    similar) system, it wil basically tell you that you're
    crazy.I am sorry but I have to intervent here, because that's plain wrong.
    You can very easily set up your linux box to execute java progs from command line.
    Look in your kernel's Documentation directory for a file called binfmt_misc.txt or read this:
    (found via http://www.google.com/search?q=linux+kernel+execute+java)
    http://www.linuxhq.com/java.html
    I admit, that wouldn't be an extremely standard setup, but could explain why the OP wants to preserve executable privileges.
    -T-

  • My Jar has nothing inside...

    Now I have a class called "Testing.class".
    I use the command line: jar cvf Testing.jar Testing.class to make the jar file. And I use: jar xvf Testing.jar to extract it to the folder. Then I view the Manifest file, and it contains the following:
    Manifest-Version: 1.0
    Created-By: 1.3.1_01 (Sun Microsystems Inc.)
    and that's all. Isn't it having all the information about the class? Please help.

    The manifest does not hold the names of the files unless the jar is signed. To see what files the jar contains, you can use the jartool comand:
    jar tf Testing.jar
    Alternatively, you may also use a zip utility like WinZip to see the files.
    -Ron

  • BAD CLASS FILE ERROR WHEN TRYING TO CALL JAVA CLASS IN WEB-INF DIRECTORY

    I AM NEW TO THIS FORUM. PLEASE HELP ME IDENTIFY/RESOLVE THIS ERROR - bad class file: /java/tomcat/webapps/ChoiceTel/WEB-INF/classes/XYZ/SMUA.class. OTHER JSP SCRIPTS THAT CALL JAVA CLASSES DO WORK WELL.
    THE FUNNY THING ABOUT COMPILIING THIS JAVA CLASS WAS - I HAD TO A jar xvf OF activation.jar and mail.jar IN THE XYZ DIRECTORY BEFORE SUCCESSFULLY COMPILING SMUA.
    THE CALL BEING MADE FROM THE JSP SCRIPT IS AS FOLLOWS:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <BODY>
    <%@ page import="XYZ.*" %>
    <%!
    %>
    <%
    SMUA sndmail = new SMUA();
    sndmail.postMail ("[email protected]","Test Subject","What Message","[email protected]");
    %>
    </BODY>
    </HTML>

    Dude. Please don't shout. If your keyboard is like mine, it can produce both upper and lower case letters. Please use them appropriately.
    Do you have the activation.jar/mail.jar available in the WEB-INF/lib directory for this application?

  • Help adding new files to Jar file.

    I am new to Java and am having problems haveing our Web App work after I have recreated the JAR file...this is what I did...
    Changed to the following directory at a dos prompt:
    D:\jdk1.3.1_01\bin
    Ran the following to extract the files from the jar file.
    jar xvf app2.jar
    ...this created 5 directories with various files.
    copied new and updated graphic files to
    D:\jdk1.3.1_01\bin\app2\images
    Recreated the jar file using the following command (pv com javavp meta-inf borland are the 5 directories that were extracted from the original jar file above):
    jar.exe cvf app2.jar pv com app2 meta-inf borland
    I now have a new jar file that is a similar size, so it looks good, but when I put it in our web site, it does not recognize certain frames (that get information from the database) that it did before (the frames are blank)
    Any thoughts on what I am doing wrong?
    Also, are there any Windows programs that i can use to make this easier instead of using the dos commands?
    Thanks...

    To change the contents while inside a java program, you might be able to use Runtime.exec(String[]). Make the array with "jar.exe" as the first index, flags in the second, and remaining arguments in the remaining indecies.

Maybe you are looking for

  • How to remove a maintenance transaction in dswp?

    Hi All We have had a problem with one of our maintenance transactions in DSWP and I want to remove it  completely. Does anyone know how to do this? Thanks Phil

  • ICloud not syncing and Contact problems with merging duplicates

    I was having problems with the syncing of my notes app. When I got the iphone 5 I had since using Mountain Lion I had started to make use of the fact that the notes sync across iCloud. Great. Although not for long. Everything was going fine notes wer

  • DMU 1.2 stuck in Execute Post Conversion Tasks

    It is stuck in the post execution conversion tasks.  I don't even see the steps listed.  DBSNMP somehow got in while the DMU was up. I put the db in blackout but should have put in restricted mode also, which i did after killing the dbsnmp session. F

  • OM: Default Order Type doesn't show my Order Types

    Hi All, We were using Apps 11i(11.5.10.2)and we are done with all module setups. i am trying to give Default order type as my Order type i coudn't see my values(Order Types) there in the profile option(OM: Default Order Type). Please advise me.. Than

  • Selecting appropriate tax code based on Item and Ship to Address

    In the US, there is the ability to denote an Item's tax liability on the Item master. There is also the ability to denote tax code on the ship to address. In the US, some states tax products; some states tax maintenance; and some states tax services.