Run Executable Jar with MS Java VM

I downloded an executable jar at work and tried to run it using the current MS Java VM (running on WIN98SE) without sucess.
How do yo do this?

from command line window:
java -jar yourjarfile.jar
(it runs only if the default class of the package have 'main')...
p.s. very easy to find at google... ;)
EOF

Similar Messages

  • Running a .jar with a java program on unix

    I am trying to run a jar file with this java code but when i run it, it comes up with built successfully but the file doesn't run.
    ps- I use a unix os
    public class Main {
    public static void main(String args[]) throws IOException, InterruptedException {
    // first method i tried:
    Runtime.getRuntime().exec( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar output.out ascii workload2.trace 0"});
    //second method i tried:
    ProcessBuilder pb = new ProcessBuilder( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar"});
    pb.redirectErrorStream( true );
    pb.start();
    thanks a lot in advance!

    javalavaguava-- wrote:
    I am trying to run a jar file with this java code but when i run it, it comes up with built successfully but the file doesn't run.
    ps- I use a unix os
    public class Main {
    public static void main(String args[]) throws IOException, InterruptedException {
    // first method i tried:
    Runtime.getRuntime().exec( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar output.out ascii workload2.trace 0"});
    //second method i tried:
    ProcessBuilder pb = new ProcessBuilder( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar"});
    pb.redirectErrorStream( true );
    pb.start();
    thanks a lot in advance!I don't see any mention of 'java' when trying to execute the jar file. You have to specify which application should process a jar file - it doesn't magically know to use java.
    P.S. You should read the 4 sections of [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html] and implement ALL the recommendations.

  • Running executable jar with additional classpath

    Hi,
    I have specified a classpath entry in my manifest file for library.jar and a main class entry for main.class in my myapp.jar archive.
    I can run myapp using
    java -jar myapp.jar
    when the library.jar is in the same directory like myapp.jar.
    Is there a way to put library.jar in another directory and still run myapp with something like
    java -classpath /path/to/library.jar -jar myapp.jar
    Background:
    I want to share library.jar for different jars in different locations and do not want to copy it to all those locations...
    Nils

    Is there a way to put library.jar in another
    directory and still run myapp with something like
    java -classpath /path/to/library.jar -jar myapp.jar
    When you use the -jar option of the java application launcher, the only Classpath that is used is the jar file or the Classpath specified by the Class-Path line in the mainifest of the jar.
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html
    But, instead of using the -jar option, you can use the -classpath option and include all of the jars, including the jar with the main-method class.
    java -classpath /path/to/library.jar;path/to/myapp.jar myapp.jar.MainClass

  • Running executable jar from within a java program

    Is there a way to launch an executable jar in a java program? I tried wrapping the jar in an exe and calling it using Runtime exec() and though this approach works it does only for windows. I want it to work for unix/linux too.

    jaki wrote:
    Yes, but it's a sub process.Nope.
    Hence the calling process doesn't quit unless the called one returns.Wrong.
    My calling program is actually a jar and what Im trying to do is delete the jar after it's done running. But the above method (of launching a separate jar doing the deletion) doesn't seem to work for the above mentioned reason.Wrong.
    If you could tell me any other way it would really be a big help.You don't need any other way. Maybe you need to allow some time for the calling program to wind up. 20 seconds may be overkill, but I'm not in the mood to find how short it can be and still succeed.
    The two classes are packaged in separate jars.import java.io.IOException;
    public class Deletee {
        public static void main(String[] args) {
          try {
             String[] cmds = {"java", "-jar", "E:/temp/Deleter.jar"};
             Runtime.getRuntime().exec(cmds);
             System.exit(0);
          } catch (IOException ex) {
             ex.printStackTrace();
    import java.io.File;
    import javax.swing.JOptionPane;
    public class Deleter {
       public static void main(String[] args) {
          File file = new File("E:/temp/Deletee.jar");
          try {
             Thread.sleep(20000);
          } catch (InterruptedException ex) {
             ex.printStackTrace();
          if (file.delete()) {
             JOptionPane.showMessageDialog(null, "Deleted");
          } else {
             JOptionPane.showMessageDialog(null, "Oops");
    }Try it and see for yourself.
    db

  • Executable jar with package

    Hello,
    I have been making jar files and using the manif.txt. But today, I have the need to create a executable jar with a package.
    eg: com.skp.util
    I typed in my manifest.txt
    Main-Class: com.skp.util.classname
    (and made sure my return was there).
    Then I jar cmf manifest.txt test.jar classname.class
    But when I run it, I get a class not found error:
    Thanks,
    What does one need to do differently to get packages to work.

    I tried that with a very simple class, but it does not appear to work?
    When you run the jar do you use the package name there?
    Here is all I have, it is simple:
    mymanif.txt
    Main-Class: com/ddi/ags/convert/showargs
    Here is how I am crating the jar
    jar cmf mymanif.txt test.jar showargs.class
    And I run it like this:
    java -jar test.jar
    And get this error:
    $ java -jar test.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: com/ddi/ags/convert/s
    howargs
    And here is the class:
    package com.ddi.ags.convert;
    import java.io.*;
    import java.util.*;
    public class showargs
    File log_file = new File("C:/testlog.txt");
    public static void main(String[] args) throws Exception {
         if (args.length < 1)
         System.out.println("args are less than one.");
         System.exit(1);
         } else {
         FileWriter writeit = new FileWriter("C:/testlog.txt", true);
         for (int i = 0; i < args.length; i++) {
              writeit.write(args[i] + "\n");
              System.out.println(args);
         writeit.close();
         System.out.println("all done with testing.");

  • How to run JavaFX Jar with JRE 7 on MAC OS Lion 10.7.5 ?

    I had java 1.6 installed on my MAC OSX Lion 10.7.5. When I am trying to run that JavaFX application jar
    java -jar application.jar
    It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.
    It installed jre-7u10-macosx-x64.dmg but java -version is always point to 1.6.
    Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.
    I found an Java Icon on System Preference. When I am trying to open that widow it's showing me error -- the java control panel opens in a separate window and nothing happens when we click on Re-open the Java Control Panel.
    http://avats.s3.amazonaws.com/JavaRunningError.txt
    I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?

    To find a copy of LP7 you would need to look for a copy on eBay.. However, the protection method used with LP7 no longer functions so you cannot register it and therefore you cannot use it. unless you have already registered LP7 yourself in the past using the security key dongle provided
    Any version of LP7 from a torrent would be an illegal (and most likely non working) version due to the protection that was used at that time... and so posting about it here, was not be wise.
    So.. thats why my previous answer was so brief... Simply put, you cannot use LP7 unless you already have a validated and registered security dongle... even if you found a copy of LP7 somewhere
    The only practical solution is to find some kind soul who already has a working version of LP7 installed, that you can send the projects to... for them to do the conversion for you.
    I would, but I no longer have LP7 installed here on any of my testbed Macs...

  • How to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5 ?

    I have created a bundled JavaFX application jar with ANT on Windows 8 O.S. , 64 bit machine. I have JavaFx2.0 and Java 1.7.0_09 installed on my Window O.S.
    <target name="CreatingJars" depends="Compiling" description="generate the distribution" >
                        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"     
                                 uri="javafx:com.sun.javafx.tools.ant" classpath="${env.JAVA_HOME}/lib/ant-javafx.jar"/>
                              <mkdir dir="${WorkingFolder}/temp/libs"/>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset file="${WorkingFolder}/CustomJars/ProjectLib.jar">
                             </fileset>
                             </copy>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset dir="${WorkingFolder}/libs">
                             </fileset>
                        </copy>
                        <fx:jar destfile="${WorkingFolder}/${app.name}.jar">
                        <fx:application mainClass="${main.class}"/>
                        <fx:resources>
                             <fx:fileset dir="${WorkingFolder}/temp/"/>
                        </fx:resources>
                        <fileset dir="${WorkingFolder}/build"/>
                        <fileset dir="${WorkingFolder}/resources"/>
                        </fx:jar>
         </target> When I am trying to run that JavaFX application jar on MAC OS Lion 10.7.5 using
    java -jar application.jar
    It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.
    java -version is always point to 1.6.
    Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.
    I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?

    Do I need to download the whole JAVA 1.7 on MAC to run the JAR? No
    Can not I run the Jar file with Jre7?Yes, you can.
    This may be because I have downloaded the JRE 1.7Yep, that's correct, the java_home command only works for jdk's - sorry for the confusion.
    For jre7+ versions, only a single Oracle jre version is allowed to be installed on the machine at a time - making a tool like java_home redundant for jre checking.
    Weirdly, jre7u10 does not supplant the Apple Java on the command line path by default. If you just type java -v, then the Apple java version will displayed if you have an old Java 6 from Apple and a new Oracle jre7+.
    The Oracle jre is always located under (also somewhat strangely):
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/javaTo test jar launching, I used the willow JavaFX browser pre-release jar available here:
    http://code.google.com/p/willow-browser/downloads/detail?name=Willow-0.1-prerelease.jar
    Then I launched the jar from the command line using:
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -jar Willow-0.1-prerelease.jar The JavaFX jar ran fine on jre7 with the above machine.
    The test machine was running Mac OS X 8 with Oracle jre7u10 installed as well as the Apple Java 6 runtime, but no Oracle jdk7+ installed.

  • How to run execute immdiate with variables

    Hi friends,
    How to run execute immdiate with variables in v_stmt below?
    I dont know how to declare the value of i here.
    Set serveroutput on;
    DECLARE
       i        VARCHAR (20);
       v_stmt   VARCHAR2 (100);
       CURSOR c
       IS
          SELECT sqlid FROM temp1;
    BEGIN
       OPEN c;
       LOOP
          FETCH c INTO i;
          EXIT WHEN c%NOTFOUND;
          DBMS_OUTPUT.put_line (i);
          v_stmt := 'select * from table(dbms_xplan.display_cursor('&i',null))'
          execute immediate v_stmt;
       END LOOP;
       CLOSE c;
    END;
    /Regds,
    Kunwar.

    You first need to use a bind variable (named ':v' in SQL statement in my example):
    set serveroutput on;
    DECLARE
       i        VARCHAR (20);
       v_stmt   VARCHAR2 (100);
       CURSOR c
       IS
           -- modified for a quick test
          SELECT sql_id FROM v$sql where child_number > 2;
    BEGIN
       OPEN c;
       LOOP
          FETCH c INTO i;
          EXIT WHEN c%NOTFOUND;
          DBMS_OUTPUT.put_line (i);
          v_stmt := 'select * from table(dbms_xplan.display_cursor(:v,null))';
          execute immediate v_stmt using i;
       END LOOP;
       CLOSE c;
    END;
    /However because your SELECT statement returns several rows you need to adapt your code to process all rows returned (as already suggested in first reply to your message).
    Instead of using PL/SQL, I recommend to generate a SQL file using only SQL and then to run the generated SQL file.
    For example:
    spool edx.sql
    set serveroutput on
    declare
    v_stmt varchar2(100);
    v_q char(1):='''';
    begin
    dbms_output.put_line('spool edx.log');
    for s in (select sql_id from v$sql where child_number >2)
    loop
      dbms_output.put_line('select * from table(dbms_xplan.display_cursor(' || v_q || s.sql_id || v_q || ',null));');
    end loop;
    dbms_output.put_line('exit');
    end;
    spool ofThis generates a SQL file similar to :
    spool edx.log
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('fsbqktj5vw6n9',null));
    select * from table(dbms_xplan.display_cursor('6q42j0018w7t8',null));
    select * from table(dbms_xplan.display_cursor('a5mmhrrnpwjsc',null));
    select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
    select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
    select * from table(dbms_xplan.display_cursor('9gkq7rruycsjp',null));
    select * from table(dbms_xplan.display_cursor('f0wj261bm8snd',null));
    select * from table(dbms_xplan.display_cursor('ab3swhv5g138y',null));
    select * from table(dbms_xplan.display_cursor('6vgvyh4xw9c5g',null));
    select * from table(dbms_xplan.display_cursor('ak5crjygnpk60',null));
    select * from table(dbms_xplan.display_cursor('9p6bq1v54k13j',null));
    select * from table(dbms_xplan.display_cursor('19x1189chq3xd',null));
    select * from table(dbms_xplan.display_cursor('7sx5p1ug5ag12',null));
    select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
    select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
    select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
    select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
    select * from table(dbms_xplan.display_cursor('a1zv6wju3ftgv',null));
    select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
    select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
    select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
    select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
    select * from table(dbms_xplan.display_cursor('g4gp07gt2z920',null));
    select * from table(dbms_xplan.display_cursor('1gu8t96d0bdmu',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('bn4b3vjw2mj3u',null));
    select * from table(dbms_xplan.display_cursor('38243c4tqrkxm',null));
    select * from table(dbms_xplan.display_cursor('2abjfnvy5rkyg',null));
    select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
    select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
    select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
    select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
    select * from table(dbms_xplan.display_cursor('1tgukkrqj3zhw',null));
    exit
    PL/SQL procedure successfully completed.Edited by: P. Forstmann on 20 mars 2013 19:06
    Edited by: P. Forstmann on 20 mars 2013 19:33

  • Running executable JARs from Windows

    Hi!
    I have this executable JAR file with no problems for running it from the Windows console using the "java -jar jarfile" command. But if I double click the same JAR file in Windows explorer I get a "Main class not found" error. Does anyone know what's happening here ?
    Thanks in advance

    I think the following varies somewhat depending on which Windows you are using. On Win 2000 in a Windows folder, select Tools menu, Folder Options and select File Types. Then select JAR and click on Advanced. Under Actions, there select "open" and click on Edit. For the Application, you should see something like "C:\Program Files\Java\j2re1.4.1_01\bin\javaw.exe" -jar "%1" %*

  • Executable Jar with -D internal

    I have created an executable jar file which works great. The program uses the users USERNAME and USERDOMAIN environment variables to log usage to a database. This works great when they use the command line of:
    java -DUSER=%USERNAME% -DDOMAIN=%USERDOMAIN% -jar c:\a.jar
    But my problem is that the users will sometimes just double click on the .jar file which will run the app but the environment variables are not available because the -D's were not included.
    Is there a way to update the manifest file so the -D options are always passed to the jar file?

    You can use System.getenv() under java 5.0

  • How to run a jar file using Java application.

    Hi all,
    I know that jar file can run using the following command, using the command prompt.
    java -jar jar-fileBut I don't know how to run that command through a Java code. Hope it's clear to you.
    So can you please explain how can I do it.
    Thanks,
    itsjava

    rayon.m wrote:
    The solution given by ropp appears to have nothing to do with what you asked about.Ok sir, I got the point.
    I've try a test as follows. But it doesn't give any output. Even not an exception.
            try {
                String[] temp = new String[]{"java", " -jar", " MainApp.jar"};
                Runtime rt = Runtime.getRuntime();
                Process proc = rt.exec(temp);
                int exitVal = proc.waitFor();
                System.out.println("ExitValue: " + exitVal);
                System.out.println("Temp_Values");
            catch(InterruptedException ex) {
                System.out.println(ex.getMessage());
            catch (IOException ex) {
                System.out.println(ex.getMessage());
            }I've debug and see, but the exitValue is even not exist at run time. Can you tell me where I'm going wrong.

  • Execute jar from my java code

    Hi,
    My CDC application run in Windows Mobile, with Creme JVM.
    I need from my java code, run other .jar. and later, finish may application atual.
    I try like this:
    Runtime.getRuntime().exec("\\Windows\\CrEme\\bin\\CrEme.exe -jar \\Windows\\sample\\cube.jar");
    System.exit(0);
    But my second jar its not started. Anybody can help me?
    Other question, If I getRuntime(), am I using the atual instance of my JVM. If I exec other JAR, and later exit() my atual, the second jar its exit too?
    I'm building a automatic upgrade module in my application. With Hessian (Web Service), I download my new jar. But, I need have other jar, start it and close my jar atual. My second jar showld be delete my atual, rename the new jar downloaded for the standard name, and later start the jar download, how new version.
    thanks,
    Fabio
    Edited by: FabioPinheiro on Mar 28, 2008 4:41 AM

    Hi all,
    The Mr. Rene (from NSIcom) answer my question
    Just
    Add flag -mi.
    (multiple instance)
    I try and work fine.
    thanks Rene..
    Fabio

  • Running executable jar

    HI there, if i compress my application into an executable jar, what would a user need to run it on their machine? (Would they need to have java installed on their machine)Its a simple application that writes to a file.

    HI there, if i compress my application into an
    executable jar, what would a user need to run it on
    their machine? (Would they need to have java
    installed on their machine)Its a simple application
    that writes to a file.The user would need the JRE (Java Runtime Environment) installed, yes. They would not need the SDK (which includes the JRE).

  • How to run executable jar on client machine remotely?

    Hi,
    I have developed PHP web application that uses Java in the background. The problem that I want to solve is to start Java application (executable jar) on client machine.
    Is there any idea how to solve this problem?
    Zoran

    found it:
    in the Group Policy Management Editor go to Computer Configuration > Policies > Administrative Templates > System > Logon > Run these programs at user logon, and add the path (on the local computer) to the script to be run when any user logs
    in.  Powershell scripts need to be called from a .vbs script like this in order to prevent window popup:
    Dim objShell
    Dim cmd
    Set objShell = CreateObject("Wscript.Shell")
    cmd = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -nologo -noProfile -NonInteractive -ExecutionPolicy bypass -File c:\mypowershellscript.ps1"
    objShell.Run cmd,0
    As for distributing the scripts, that's a work in progress... GPP?

  • Running executable jar files

    Here's my problem. I have my main application which invokes several executable jar applications everytime a menu is selected. I was able to do this using Runtime.getRuntime().exec("java -jar myapp.jar");
    However, my main application(window) minimizes everytime other applications are executed. Is it possible for me to display my main application at the back of my invoked applications just like a parent frame with several internal frames.
    I have a friend who's doing the same thing but in visual basic. And he doesn't have this problem.
    looking forward for answers.
    a million thanks.

    Here's my problem. I have my main application which
    invokes several executable jar applications everytime
    a menu is selected. I was able to do this using
    Runtime.getRuntime().exec("java -jar myapp.jar");
    my initial thought is:
    if all of this is java, then why not invoke the main method of
    myapp.jar and use a new thread if required?

Maybe you are looking for

  • Import  and export of a project.

    Hi, I want to know the steps of import and export of a project. 1.I am using DTR. 2.I selected a track, after that a SC. 3.There are a lot of DCs. 4.Now i am to select some DCs. 5.there are five DCs that makes an application. Questions: 1.How i am to

  • BEA apache bridge

    "Hi The bridge is giving me gief beond all I have experienced before:I need to prepend a document root for a virtual site in apache, so that the weblogic server looks for files in the same drawer as apache:www.myserver.com/tm/tm2000/index.jsp is tran

  • Message bundle always loading default bundle???

    I have propertly created message bundle properties file. But I have problem in situation when I use example: <h:commandLink value="#{bundle.sLogout}" styleClass="HeaderLoginText" action="#{page.logout}" rendered="#{page.logged}"/> in this case my app

  • Elements 9 will not load

    I have elements 9 loaded on two computers running on windows 7. It runs fine on one and I receive an error on the second which says Photo Shop  Elements has stopped working. I have tried reloading the program with the same results. The organizer seem

  • Photoshop CS5.5 printing problem

    I recently upgraded to PhotoshopCS5.5 and find that I can't print on my HP Photoshop Premium printer.  I'm using a MacBook Pro with Mac OSX 10.6.8.  I also am unable to open 2 images at the same time.  Any suggestions?