Jar running jar

I am running java application in windows xp and want to execute from this application another jar file.
How can I do it ?
Regards Amnon

Maybe you could do this:
Runtime r = Runtime.getRuntime()
Process p = r.exec("javaw -jar assKickinApp.jar");
...:: byElwiZ ::...

Similar Messages

  • Error while running (java -jar orion.jar -install)  Need yr help ?

    Hi,
    I have
    Win 2000 Professional
    Oracle 9i release 1and have the Pre-Requisites of MapViewer as follows.
    OC4J_extended (Pre-Requisite for MapViewer)
    XML Parser (Built-in OC4J)
    Oracle 9iI don't know whether I have Oracle Client or not which is also pre-requisite for MapViewer ? I think it is built-in with any of the above... most probably with Oracle 9i !!!
    I have JDK1.3 as wellI have Oracle9iAS release 1.0.2.2.2a, but I don't want to use it, as I have OC4J standalone...
    I want to have the configuration, for using Oracle Spatial/MapViewer.... How can I do that ? I need steps/procedure...
    I am having problems in configuring OC4J which I have downloaded. I have unzipped OC4J_Extended in Oracle 9i Database home directory (not in Oracle 9iAS home directory... because I dont have installed iAS)
    Its installation guide asks for installation through the following command
    java -jar orion.jar -installbut after unzip, I don't get any file named "orion.jar"
    What should I do ? Where am wrong ? Should I have to use 9iAS for using MapViewer in any case, if so which version ? I need the heirarchy of steps ?
    I m really stucked !!!
    Any help would be highly appreciated.
    Thanx
    Zaaf.

    Hi,
    If you are just using OC4J, you should only need to do:
    java -jar oc4j.jar -install
    Also note that you should not install oc4j in the oracle_home
    directory. If/when you upgrade oracle to apply patches, etc
    it will overwrite/cause problems with your oc4j install if you
    put it in the oracle_home directory. Put it in any other directory.
    The only part of Oracle9iAS needed to run mapviewer is oc4j.
    After that is installed, then follow the instructions in the MapViewer
    User's Guide (available on OTN).

  • Getting error while running command java -jar oc4j.jar -install

    java -jar oc4j.jar -install
    ON RUNNING The above command getting below error , is it because Java home is not set?
    Warning: -jar not understood. Ignoring.
    Exception in thread "main" java.lang.NoClassDefFoundError: oc4j.jar
    at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
    at JvThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
    at JvRunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
    at __gcj_personality_v0 (/oracle/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/java.version=1.4.2)
    at __libc_start_main (/lib/tls/libc-2.3.4.so)
    at JvRegisterClasses (/oracle/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/java.version=1.4.2)
    navisdb.igglobal.com(express)$ javac
    ksh: javac: not found
    ENVIORNMENT DETAIL : RED HAT LINUX ENTERPRISE EDITION
    Extracted OC4J_extended.zip file at oracle 10g installation location.

    does this command work?
    /home/oracle:MCSE>gij --showversion
    gij (GNU libgcj) version 3.4.6 20060404 (Red Hat 3.4.6-11)

  • How to create a running jar-file

    I created a "Java Class Library" project including 20 class files in several packages and some libraries.
    Because I would like to start the project from the console, I added the main-class property (right-click project, Properties, Run). Then I cleaned and built the project and tried to start it with the following command:
    java -jar PROJECTNAME.jarBut it won't work, because the archive is not complete: MANIFEST.MF lacks the main-class and all involved libraries.
    I managed to add the main-class attribute manually, but adding all library references seems to be very error-prone.
    So does anyone know if I did something wrong or if this is a bug of Creator?
    Regards,
    Felix

    The main intent of this project type is to provide a libraray which normally wouldn't run with a "main". I suggest you use NetBeans to create a "Java Application" project. Here's what is in the README.txt file produced with the jar. This looks like what you're looking to do. So you can create the Jar in NetBeans then if you want to use it in Java Studio Creator, you can add it to the Creator project. Also, if you caught the news at JavaOne, we are providing Creator features for a pack that will run in NetBeans so you won't have to switch back and forth between the tools. Keep an eye on the NetBeans and Creator web sites for more info.
    Thanks!
    -David
    README.txt
    ========================
    BUILD OUTPUT DESCRIPTION
    ========================
    When you build an Java application project that has a main class, the IDE
    automatically copies all of the JAR
    files on the projects classpath to your projects dist/lib folder. The IDE
    also adds each of the JAR files to the Class-Path element in the application
    JAR files manifest file (MANIFEST.MF).
    To run the project from the command line, go to the dist folder and
    type the following:
    java -jar "JavaApplication3.jar"
    To distribute this project, zip up the dist folder (including the lib folder)
    and distribute the ZIP file.
    Notes:
    * If two JAR files on the project classpath have the same name, only the first
    JAR file is copied to the lib folder.
    * If the classpath contains a folder of classes or resources, none of the
    classpath elements are copied to the dist folder.
    * If a library on the projects classpath also has a Class-Path element
    specified in the manifest,the content of the Class-Path element has to be on
    the projects runtime path.
    * To set a main class in a standard Java project, right-click the project node
    in the Projects window and choose Properties. Then click Run and enter the
    class name in the Main Class field. Alternatively, you can manually type the
    class name in the manifest Main-Class element.

  • JAR running error...please help

    I have created a JAR file, which operates on a database platform program. This is located in a different directory to the main java and class files.
    Directory of the Testing Program to run the DBP program:
    C:\CRT
    in which I've stored my test.jar which I made from the java class files for the Testing.
    I used this as you said to create my test.jar
    C:\pt\jtsc\dd\source\TgF\ <--directory where my java files are stored, there are subdirectories in this like the tester sub such as
    C:\pt\jtsc\dd\source\TgF\Tester
    My header and package importations for the main file (which begins the whole testing)teststarter.java is:
    package TgF;
    import TgF.biq.XML.*;
    import TgF.TestThreads.*;
    import TgF.Tester.*;
    import TgF.OutputGenerator.*;
    import TgF.Helpers.DateGenerator;
    import java.io.*;
    import java.util.Vector;
    import java.util.Hashtable;
    My header and package importations for the sub file Tester is :
    package TgF.Tester;
    import java.io.*;
    import java.beans.XMLEncoder;
    import java.beans.XMLDecoder;
    import java.util.Vector;
    import org.xml.sax.*;
    import TgF.OutputGenerator.WrongTypeException;
    But now I'm getting the following exceptions when I try to run this jar file which I created using
    jar cvfm name.jar manifest.txt TgF
    My Environment variables and classpaths are as such (which I've defined in the control panel)
    C:\j2sdk1.4.2_04\bin;C:\j2sdk1.4.2_04\lib\tools.jar;C:\j2sdk1.4.2_04\lib\dt.jar;C:\j2sdk1.4.2_04\lib\rt.jar;C:\jdk1.1.8\bin;C:\crt\test.jar
    The error I now get when I run the Test program is this
    C:\crt>java -jar test.jar test.xml ON
    Exception in thread "main" java.lang.NoClassDefFoundError: TgF/Test
    er/Tester
    at TgF.TestStarter.<init>(TestStarter.java:45)
    at TgF.TestStarter.main(TestStarter.java:421)
    C:\crt>pause -1
    Press any key to continue . . .
    These error lines are just lines calling the method Tester from TestStarter
    m_Tester = new TgF.Tester.Tester();
    and
    TestStarter objTest = new TestStarter();
    Please someone help me find a solution to this problem.
    Thanks for the help in advance :-)

    NoClassDefFoundError: TgF/Tester/TesterFor some reason the TgF.Tester.Tester class cannot be found. You could try checking that the file Tester.class it is in the .jar file and that it is in the subdirectory (it should be inside a directory called Tester inside the TgF directory). You can use pretty much any file compression and archival program to open the file, and on the command line you can list the contents with the "t" switch: "jar tf test.jar".
    When you generate that jar file the file Tester.class is in the directory C:\pt\jtsc\dd\source\TgF\Tester, right?

  • Read a txt file when I run jar file

    Hi all,
    I have a jar file. In ir there are:
    /file.jar
       |----/pack
       |        |----MyClass.class
       |        |----file.txt
       |
       |----/META-INF
       |        |----MANIFEST.MFI want: when I execute the jar file java -jar file.jar from the java class MyClass to read the file.txt
    When I run this the error is:
    C:\Documents and Settings\pc\Escritorio>java -jar file.jar
    java.io.FileNotFoundException: file:\C:\Documents%20and%20Settings\pc\Escritorio\file.jar!\pack\file.txt (El nombre de archivo, directo
    rio o etiqueta del volumen no es valido)
            at java.io.FileInputStream.open(Native Method)
            at java.io.FileInputStream.<init>(Unknown Source)
            at java.io.FileInputStream.<init>(Unknown Source)
            at java.io.FileReader.<init>(Unknown Source)
            at pack.MyClass.main(MyClass.java:20)
    Exception in thread "main" java.lang.NullPointerException
            at pack.MyClass.main(MyClass.java:31)the code into the java class is:
    package pack;
    import java.io.BufferedReader;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.InputStream;
    public class MyClass {
         private static String version = null;
         static String fich = "file.txt";
         public static void main(String[] args) {
              BufferedReader br = null;
              File file = new File(fich);
              try {
                   br = new BufferedReader(new FileReader(MyClass.class.getClass().getResource("/pack/file.txt").getPath()));
                   String j= null;
                   while ((j = br.readLine())!=null){
                        version = j;
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException io){
                   io.printStackTrace();
              } finally{
                   try {
                        br.close();
                   } catch (IOException e) {
                        e.printStackTrace();
              if (version != null)
                   System.out.println("I have read : "+version);
    }in MANIFEST.MF file:
    Manifest-Version: 1.0
    Main-Class: pack.MYClassthanks very much

    thanks you!!
    I have read the file, but I have put the package when I write the file.txt, beacuse If I don't put this, givas me NullPointerException
    Now I have
    InputStream in = Main.class.getResourceAsStream("/pack/file.txt");
    InputStreamReader isr = null;
    BufferedReader reader = null;
    try {
              isr = new InputStreamReader(in, "ISO-8859-1");
              reader = new BufferedReader(isr);
              while ((j = reader.readLine())!=null){
                   version = j;
              reader.close();
    } catch ...Thanks very much

  • Running jar files

    Hi,
    I hv a jar file created by compiling the program in an IDE.Now I want to run the jar file directly from command prompt.i.e I want to run it something like
    java -jar myjar.jar <arguments>
    Also the program imports another package which is included in the classpath in the IDE.
    Now while running the jar file in the command prompt do I hv to set the classpath again to include the imported package.
    Can anyone tell me how to do it??

    When running a jar, the content of the jar becomes
    the classpath. So add any class you need to it and
    you should be fine. If your jar depends on classes
    outside the jar, it will not run on other systems
    without those classes being present.Hi
    Thanks a lot.I got the answer I was looking for.
    Thanks again!!!!!

  • How run jar files from a Jlist

    I can already run my jar from command prompt
    With java -jar me.jar.
    But having a few problems with a list. Here's a bit of code I've atempted to try.
    String filename = (directory + "/" +(String)mylist.getSelectedValue());
                        String name = filename.substring(51,filename.indexOf("."));
                        //String name = filename.substring(51);
                       Runtime rt = Runtime.getRuntime();
                       try
                             Process p = rt.exec("java -jar" + name);
                        catch(IOException e){}
                        System.out.println(name);

    There may be much more wrong but since you use
    java -jar me.jar
    then I would expect the name in
    Process p = rt.exec("java -jar" + name);
    to include the ".jar" not exclude it has you have done.
    Also, why not not
    Process p = rt.exec("java -jar " + filename); // Note the space I added after the -jar
    since you seem to have the full path in the string referenced by filename.
    P.S. I just love the magic number 51 !

  • Problem running jar files of java in Linux

    I cannot run jar files in java/jdk1.3.1_01/demo in Readhat Linux 6.2
    The command is :--
    [root@localhost Notepad]# java -jar Notepad.jar
    java.lang.NoClassDefFoundError: javax/swing/JPanel
    at java.lang.Class.forName(Class.java:33)
    at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
    at kaffe.jar.ExecJar.main(ExecJar.java:61)
    [root@localhost Notepad]#
    My ~/profile setting is :---
    PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/usr/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
    export JAVA_HOME=/usr/java/jdk1.3.1_01
    export NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/ns4

    [root@localhost Notepad]# java -jar Notepad.jar
    java.lang.NoClassDefFoundError: javax/swing/JPanel
    at java.lang.Class.forName(Class.java:33)
    at
    at
    at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
    at kaffe.jar.ExecJar.main(ExecJar.java:61)
    [root@localhost Notepad]#
    My ~/profile setting is :---
    PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/u
    r/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
    export JAVA_HOME=/usr/java/jdk1.3.1_01
    export
    NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/n
    4Add the line:
    export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar
    Then, run the command "source ~/.profile" and then the jar file should be able to run.
    Bhav

  • Running .jar files in linux on double click

    Hi,
    i needed a solution to run the jar files on double click in linux system.Necessity is mainly because when i run the jar file by java -jar myapp.jar in terminal it works fine .Iam running my app continuosly in system tray(a server kind).But if i close the terminal my app exits.
    How to resolve this ?

    I am taking a SWAG.....it sounds like your problem is how to run a java app without a terminal window. So as I recall, there is some way in Linux to enter a command and have it execute in a new process. I don't recall the syntax but maybe putting a '&' character in the command line? Anyway, you should be able to use the method and use "javaw" instead of "java" to launch your app. You should be able to do this in a batch file too. Something like, javaw -jar yourjar.jar &

  • Running jar files from the command line

    I have always felt it would be useful to run a jar file from th command line in EXACTLY the same way as an EXE. On some systems, typing MYAPP.JAR will run the app, but doesn't output and command line data, so it only works for GUI apps. I've come up with a tiny C program that runs java -jar xxxx.jar for you.
    #include <stdio.h>
    #include <string.h>
    #include <process.h>
    void main(int argc,char *argv[])
         char cmd[1024];
         strcpy(cmd,"java -jar ");
         strcat(cmd,argv[0]);
         strcat(cmd,".jar");
         for(int arg=1;arg<argc;arg++)
              strcat(cmd," ");
              strcat(cmd,argv[arg]);
         system(cmd);
    }Simply compile this to an exe, rename the exe to the name of your jar file and put it in the same directory. Then just type 'MyJarFile' (no jar extension) and it should run. It passes all command live args as well. Comments ?

    Here's a better version. The JAR and the EXE can be anywhere in the PATH:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <process.h>
    void main(int argc,char *argv[])
         char jar[1024];
         char cmd[1024];
         strcpy(cmd,argv[0]);
         strcat(cmd,".jar");
         _searchenv(cmd,"PATH",jar);
         strcpy(cmd,"java -jar ");
         strcat(cmd,jar);
         for(int arg=1;arg<argc;arg++)
              strcat(cmd," ");
              strcat(cmd,argv[arg]);
         system(cmd);
    }

  • How to run .jar on linux & how to create .jar file using java?

    hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
    thanks in advance.

    Look at the manual page for jar:
    # man jar
    Also you can run them by doing:
    # java -jar Prog.jar

  • Unsupported class version error trying to run jar file on windows machine

    Hi,
    i've written a program that connects to an access database to get its data. Created a jar file with the class files, the access database and other required files.
    works fine on my home windows computer but when i try to run it on another machine i get an error.
    here's what i write on the cmd: java -Xmx128m -jar myFile.jar
    heres the error i get:
    Exception in thread "main" java.lang.UnsupportedClassVersionError: StartUp(Unsupported major.minor version 49.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    and so on.
    It seems like it might be quite a basic error but i'm lost, can anyone please shed some light and tell me where i'm going wrong?
    cheers in advance

    hey there, in case anyone was going to reply, i've worked it out now. couldn't work out what was wrong at first so just pulled out all my classes and put them into a brand new jar file. now use javaw -jar instead of java and it worked fine! wierd...

  • How to run jar files with arguments?

    Hi everybody,
    Is it possible to run a jar file with arguments passed to its MAIN class?
    If yes can you help me on how to do it?
    Thanx

    I am in complete agreement with FahleE. I'll refine it a bit.
    On my machine (running RedHatLinux8.0) you can run the demos like this.
    1. open a console window
    2. go to the directory where the demo you wish to run, say, demo.jar, is located
    for instance for the SwingSet2-demo
    cd /usr/lib/java/demo/jfc/SwingSet2
    3. run the jar file
    java -jar demo.jar
    In order to run it windows style, ie, launching by double clicking, save these lines in a file called
    LaunchJar.sh
    cd /usr/lib/java/demo/jfc/SwingSet2
    java -jar demo.jar
    where demo.jar is the jar file you want to run.
    Right click on the LaunchJar.sh and go to the 'Properties' tab. Check the 'Execute' permissions for Owner/groups/others. You can also do the same thing by chmod command.
    Now double-click on the LaunchJar.sh file: your application should be launched.
    Palash.
    Please Note: It is important to set the path variable to your JAVA_HOME directory....
    Otherwise, instead of
    java -jar demo.jar, you will need to use the full path to your JAVA_HOME/bin directory like:
    JAVA_HOME/bin /java -jar demo.jar.
    Where JAVA_HOME is the directory where you have installed java. Typically it is usr/java or usr/local/java

  • Jar runs from Dos prompt, but not when double clicked.

    Hello everyone,
    My executable jar file will run fine when called from the Dos prompt like so: java -jar myJarFile.jar
    But not when I double click it. I've associated *.jar files with java.exe as suggested here on the forums but all that happens when I double click the jar file is that I get an instance of the Dos prompt that flashes up on the screen and closes immediately. Any help or suggestions would be appreciated, thank you.
    This short tutorial I found earlier may be of help to somebody.
    http://www.cs.princeton.edu/introcs/85application/jar/jar.html

    Yes Carmello, I had associated jar files via folder options in windows explorer with java.exe, now when I have the jars associated with javaw.exe as in the following:
    ACTION:
    javaw.exe -jar "%1"
    APPLICATION USED TO PERFORM ACTION:
    javaw.exe "%1"
    I get an error dialog with the title string "Java Virtual Machine Launcher" and the error message itself is "Could not find the main class. Program will exit." when I double click on the jar file. As I said in my first post the application [GUI based with around ten different forms] runs fine when called from the Dos prompt. Any idea as to what is wrong? Thanks for replying by the way.

Maybe you are looking for