How to execute jar file in java project

hi,
i have made a proj in java in which i have put all my files in a jar file.
can somebody help me how to execute this jar file??
thanks

u can put that jar file in ur class path,,
regards
shanu

Similar Messages

  • 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

  • OpenScript/How to add .jar file to Java Code in relative path

    Hi all,
    I want to add a .jar file which can be executed separately (like "java -jar A.jar") to my recorded Java Code.I've read this wiki http://everest2.us.oracle.com/wiki/Generic_JAR_Project about how to add a .jar file to "Assets", however, I cannot figure out how to use the .jarr file in Java code,I mean , how to get this .jar file like the method the databank added in "Assets"?
    Things I did are as followed:
    1.Execute my .jar file in OpenScript Java code with absolute path like this:
    String cmd = "C:\Users\A.jar";
    Runtime.getRuntime().exec(cmd);
    This does work, but must set a absolute path in Java code like "C:\User\A.jar" ,which is not the workaround I want (I need my scripts can be run on other machines).
    2.Try to get its current path with following codes:
    File directory = new File(".");
    String currentPath=directory.getCanonicalPath();
    However,though this can get its absolute path (which is the the project path) in Eclipse like "C:\Users\Workspace\testProject", this only gets "C:\OracleATS\openScript" in OpenScript.
    I thought to copy my .jar file to the project path , got its current path in java code first,then can know the path of .jar file, but this workaround failed because of the above reason.
    I notice that in the "Assets" there are "Databanks","Object Libraries","JAR Files","Scripts". Since the databanks and scripts that added to "Databanks" and "Scripts" can be got or run in Java Code like:
    *getDatabank("DatabankName").getNextDatabankRecord(); String data = eval("{{db.DatabankName.data}}");*
    *or getScript("ScriptName").run();*
    *Is there a method to get and run the jar file added to "Assets\JAR Files" like the above?*
    Thank you very much!
    Regards,
    Angyoung

    Hi DM,
    Thanks for your reply!
    I've found a workaround,which is calling OpenScript's APIs ,such as this.getScriptPackage().getRepository() and this.getScriptPackage().getWorkspace(),etc to locate the .jar file.
    And this workaround can still work even though the script is run on other machine.
    Sorry to reply you so late!
    Regards,
    Angyoung

  • How to add .jar files in my project

    Hi all,
    i am designing a application where i want to translate some words of my web page to different language
    say, i want "search" word to be translated to french language
    i have got some .jar files google-api-translate-java-0.4.jar to do this work...
    can anyone tell in which folder to put .jar files ,so that it works in my project..
    i am using Eclipse SDK 3.3
    Thanks

    how to add .jar files in my project In your eclipse goto,
    Project --> Properties --> Java Buil Path --> Add External Jar
    By that u can select your JAR and click OK..........

  • How to add jar files to a project?

    What is the correct way to add jar files to a project?
    Jdev Help has an entry "Adding Files to a Project Using the Add Files or Directories Dialog", but when I goto File->Open as it says, there is no "Add Files or Directories" dialog.
    Using JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660 on Linux.

    That's not quite what I need, as it does not copy the files into the project, but just creates references to their original location in the filesystem. We want local copies so we can check the whole project into Subversion and not have external dependencies.
    Should I just copy the files manually (outside of Jdeveloper)? And what directory should I copy to?
    Thanks.

  • How to execute ".exe" files using java

    Hi,
      This is guruvulu,
         I have a problem in executing ".exe" files.For Example InternetExplorer.

    Hi,
    You can execute .exe files in JAVA using the following code.
    Runtime rt1 = Runtime.getRuntime();
    Process pc = rt1.exec("someexe.exe");
    you can get the output of the executed exe file in
    in = pc.getInputStream(); //this returns a InputStream
    hope this solves your problem.
    regards,
    P.Venkat

  • How to execute jar file

    Dear all,
    1. I am trying to import a .jar file and execute (run) in eclipse. I know it can be done from command window by java -jar z.jar . But I am supposed to do it in eclipse . I would appreciate your help.
    2. jar files are supposed to be executable. But in my premium window vista as well as in XP it doesnot run by double click though I have given the class path. How can it be done?

    jar files are supposed to be executable.Only if you have a file association for the extension.
    Presumably when you double-click the .jar file, Windows pops up the "Open With" dialog. Select from the list or click Browse... and navigate to java.exe (javaw.exe if you are only going to run GUI applications) in the jre/bin folder. Select "Always use the selected program to open this kind of file" and optionally enter a description for the file type before clicking OK.
    Note that a console application opened in this way may flash the console window and terminate i.e. the console will NOT remain open after the application dies.
    I don't use Eclipse so I can't help on your other question.
    db

  • How to execute .msi files from java program

    Hi friends,
    i have written a java program which invokes and thereby execute any executable files like .exe and .bat.
    So its working fine with .exe and .bat files, but it is not working with .msi files.......can you please help me how can i execute .msi files as well??
    public class Executeexe {
         public static void main(String ar[])
              try
              Process p=null;
              Runtime rt=Runtime.getRuntime();
              p=rt.exec("D:\\mysql-essential-5.0.83-win32.msi");
              p.waitFor();
    catch(Exception e)
    }here is the program

    Make sure that the command that's being exec'd works from the cmd line.
    Then read this article and do what it says:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    Then if you still are having problems explain what "...it is not working with .msi files..." really means, and provide a [SSCCE Example program|http://mindprod.com/jgloss/sscce.html]

  • Making Executable Jar file using java Application

    Following Program creates the jar file at specified location. but, I wonder why this file does not execute on double clicking on it, in spite of that the Manifest file contain correct main class file name
    //MakJar.java
    import java.io.*;
    public class MakJar
    public static void main(String[] args)throws IOException{
    Process p;
    String str="D:\\Himesh\\JFiles";
    try {
    BufferedWriter out = new BufferedWriter(new FileWriter(str+"\\mainClass.txt"));
    out.write("Main-Class: TestFrame\n");
    out.close();
    } catch (IOException e) {
    try
         p=Runtime.getRuntime().exec("cmd /c D:\\Java6\\jdk1.6.0\\bin\\javac.exe "+str+"\\TestFrame.java");
         p=Runtime.getRuntime().exec("cmd /c D:\\Java6\\jdk1.6.0\\bin\\jar cvmf "+str+"\\mainClass.txt "+str+"\\Demo.jar "+str+"\\*.class");
    catch(IOException e)
    System.err.println("Error on exec() method");
    e.printStackTrace();
    }

    Sir,
    On execute the jar using a "java -jar. . ." command. it gives the error--
    "Exception in thread "main" java.lang.NoClassDefFoundError : TestFrame"
    On Extracting the files from jar file made by the java program,i found that the manifist file ( containing the name of main class) and t the class file are included in the jar file.
    But if I make the jar file manually it works perfectly.I have even reinstalled the java but the problem persists
    Same thing happen if i use MS-DOS batch file.
    ??????If i put the batch file in the same directory and execute it The resulting jar file works,But
    ??????if the batch file is executed from outside the directory The resulting jar file fails execute.
    what should i do???

  • Execute jar file without java

    we have got an jar file which when ported on a machine without java should be executed.

    we have got an jar file which when ported on a
    machine without java should be executed.If it needs to be a JAR and can't use native compilation, then you probably have a problem. Except if you want to create a JVM-containing wrapper around it, with the effect that a 200 kB JAR will become a 90 MB executable.

  • How to execute Jar file on OS startup?

    Is it possible to execute a jar file on os startup? If so what should I do?
    I was thinking of adding the jar file to be executed into the "C:\Documents and Settings\All Users\Start Menu\Programs\Startup" directory but that is just for win xp.
    Thanks.

    Perhaps look at a java service wrapper
    http://wrapper.tanukisoftware.org/doc/english/introduction.html

  • How to record .jar file using Java Protocol

    Hi,
    I Tried to record .jar using Java protocol by using HR Loadrunner 11.0 Version tool.
    Am unable to record the application.
    Can any one suggest me the process of recording .jar file using load runner?
    Thanks,
    Venkat

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

  • How to execute batch files in java

    Hi,
      I am trying to execute a batch file using a java program(StopServer in sdm).But i am not able to execute it.

    Greetings.
    You may read this article (http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html)
    to avoid of getRuntime().exec() traps.

  • How to execute .jar file? (found solution)

    I downloaded the tonicpoint viewer for pps (i dont want to install OOo just for pps) and it comes as a .jar that claims to be executable in most environments, but when i double click on it i'm asked what program to be used to open it? trying to execute it from the terminal also fails with a permission denied (user or root). i'm unfamiliar with .jar, can anyone help? thanks
    solution found, so can be disregarded
    Last edited by no24 (2007-02-09 00:42:32)

    no24 wrote:solution found, so can be disregarded
    Well, in case someone else is looking for it:
    java -jar PROGRAM
    ... and please add [solved] to the thread title. Thank you.
    Last edited by mutlu_inek (2007-02-09 01:05:41)

  • How to execute .bat file through java?

    I already create a batch file to pull & push file. Now, i want to execute this .bat file java.I got this example but it doesnt work. Did i missed something or do we have the better one?
    import java.lang.*;
    import java.io.*;
    public class Loadfile
    public static void main(String args[]) throws IOException
    Runtime load = Runtime.getRuntime();
    r.exec("C:\\pull.bat");
    }

    For Runtime,i'd change it to:
    Runtime load = Runtime.getRuntime();
            String cmd = "C:\\javaclass\\copytemp.bat";
            Process proc = load.exec(cmd.toString());Is it right? But still can't work.
    Here is the .bat file:
    @echo off
    c:
    cd "c:\Inetpub\ftproot\Debitin"
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo open localhost
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo Administrator
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo password
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo cd ftpScript
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo binary
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo lcd C:\
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo lcd "C:\Inetpub\ftproot\infile"
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo prompt n
    pause
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo mget *.txt::@rem >> C:\Inetpub\ftproot\Logrecord\pullscript.txt echo mdel *.*
    C:\Inetpub\ftproot\Logrecord\pullscript.txt echo byeftp.exe -s:C:\Inetpub\ftproot\Logrecord\pullscript.txt
    ::del C:\Inetpub\ftproot\Logrecord\pullscript.txt
    pause
    exit
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • Upgradation from XI 3.0 to PI 7.4

    Hello All, My client want to update all the interfaces in XI 3.0 to PI 7.4 single stack version. Can anybody throw some lite on how to upgrade to PI 7.4? What are the impacts and issues might face? Thanks Sridhar Goli

  • Should I buy 2x1GB or 2x2GB ?

    Hi! I am thinking of adding 2x2GB SuperTalent(54€) next to the 2x1GB SuperTalent which are already in the system. 1. What kind of issues should I expect with all four banks filled? Since I have heard that the memory controller on Athlon's don't handl

  • Int 2 Serializable

    I have a file with a construction: Serializable[] serializable = new int[n]; It was generated with jad.exe decompiler from .class file. When I use javac compiler (java version v1.2.2) it reports an error that the types java.io.Serializable and int is

  • How to use pdf annotation data generated by Digital Edition to different Pdf reader?

    Hi, I am working on an application which is suppose to use Adobe Digital Edition PDF annotation data in another pdf reader. Using Digital Edition Annotation Data we need to generate highlights and notes. My question is : How we can read this Adobe Di

  • [Audio] Browser Quicktime is a black bar instead of a player.

    Hi all, When I open a music file from a website (liveset from DJs for example) a new tab opens up with the little quicktime bar. The problem is, the music plays but the bar is just plain black. So I cant scroll back and forth or see where the 'play'