How to execute a jar file in a java application

Hi,
I've already try to execute a jar file by this way :
Runtime.getRuntime().exec(java -jar myJarFile.jar);
But the problem is that the display doesn't launch. Normally a "JFrame" display.
however the corresponding process is launched.
So i would to know if there is a way to execute a Jar File without using the Runtime class.
Is there a specific class for the Jar File?
Thank you.
Richard

Create a 'manifest' file pointing to the 'main' class, jar it into the .jar file, place it onto your desktop - or whereever you can click on it, and click on it.

Similar Messages

  • How to call a .jar file from a java bean?

    any body knows how to call a .jar file from a java bean?

    Crosspost!
    http://forum.java.sun.com/thread.jspa?messageID=4349619

  • How to make a jar file from a java file?

    how to make a jar file from a java file, is there any one tht can help me thank you;

    You can study this.
    http://java.sun.com/docs/books/tutorial/jar/basics/index.html

  • How to execute a jar file which has an applet, without using a html file ?

    I have a jar file which contains a set of class files. iam able to execute the jar file by using this html code
    <html>
    <applet code="file.class" archive="file.jar" width="500" height="300">
    <param name="name" value="value">
    </applet>
    </html>
    I want to know how to execute this class file without using the html tags.
    pls help me out in this.
    Anki

    Hi,
    You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
    1. Open a notepad and write the following
    Main-Class: XXXXXXXX
    XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
    2. Save the file as Mani.mf
    3. In the commant prompt ( your directory ) type following lines.
    jar cmf Mani.mf Demo.jar *.*
    4. This will make a jar file which is executable jar file
    Hope this will help you.
    Deepak

  • How to execute a jar file in other machine?

    Hi all,
    I am working with java. and my machine is connected to LAN.I would like to execute a jar file in my machine from a remote machine that is also connected to LAN.how should i go about doing this.Help me if somebody have a solution as i am badly in need of this.
    Regards,
    Mohan

    Hi Mohan.tkm,
    If you want it to be done in pure Java and independently of the OS of both computers, you may build a RMI server that will launch your JAR by request of a remote RMI client.
    There's an example of RMI here .

  • How to create a .exe file for a java application

    Hi, I want to create a .exe file for a java application I am developing so that I can schedule it to run at a particular time using Windows Scheduler on WinNT. Is there any way to accomplish this? Or is there any other way in which a Java application can be scheduled to run at a particular time on Windows everyday?

    Create a .bat file and run that. Just have, in the .bat file:
    java YourClassName Alternatively, you can use javaw YourClassName (without *.bat, just put it into Windows Scheduler like suggested above).
    using javaw won't pop up any window...

  • How to create a exe file from a Java application

    hi,
    i have developed an application in java,now i want to distribute it to my client, for this i need to build a .exe file out of this application.
    i already have a jar file ,now can i convert a jar file to a exe file.
    im trying this out with JSmooth project but im getting it right, so can anyone help me .
    thanks,
    vishal j

    if u use dos to run your app like
    "java myapp"
    u can create a shortcut link
    in target wright java remove the path
    just leave the file name without the extension,
    like this Target: "java myapp"
    when u click on appy u'll c that java gets its full path, thats fine
    that works 4 me, ofcourse ur client needs to have JRE or JDK.

  • How to start a .hlp-file from a java-application?

    This is what I have done so far:
    if(button == helpButton){
                   try{
                        String helpFile = "help.hlp";
                        Runtime.getRuntime().exec(helpFile);
                   catch(IOException e){
                        textArea.append("The helpfile could not be opened." + "\n");
              }When i press the helpButton it throws the IOException. Does anyone know why?

    And a short explanation:
    You can "start" that file by typing it into the shell, but it's still no executable (.com or .exe). The shell will search the registry for the associated application, run its executable and hand over the file to be opened as a command-line argument.
    If you just Runtime.exec the filename, there is no shell that could do this work, and thus the process fails. With "cmd /c" you can invoke a shell session to execute the command.

  • How to Consume a WSDL file in Webdynpro JAVA Application 7.30

    Hi Experts,
    My requirement is,I have a wsdl file(Provided by the SAP PI) which i need to consume in Webdynpro Java 7.3(NWDS 7.30).
    I has been tried in the follwing way
    1.First click on the Model --> Adaptive Web Service Model -->Model Name--Package Name
    2.Choose Remote Location/File System.
    3.After that choose the WSDL file from my project which i added earlier.
    4.After that I get the node in the context menu.But I am uneble to set some data into the node and also uneble to get data data from the node
    After deploying my project I get the following error.
    Error ::
    The initial exception that caused the request to fail, was:
    com.sap.esi.esp.service.server.query.discovery.ExtendedServiceException: Configuration not found for service reference with ID: c73e38ff-a4d8-4e4c-89c2-827fd5cf17ac from application demo.sap.com/mwebsrvc. Either you have not assigned the Service Group to a Provider System or the generation of the configuration has failed. Check the configuration details from SAP NetWeaver Administrator -> Application Communication. --> Details about the Service Reference: {urn://TestSOAPtoRFCSender}SI_TestSOAPtoRFCSender_OB; Service Group: com.tsecl.SITestSOAPtoRFCSender_OB.pidev_nerapdrp_gov_in; Service Group Software Component: demo.sap.com/mwebsrvc; Service Group Application: demo.sap.com/mwebsrvc; Configuration state: Not configured
        at com.sap.esi.esp.service.server.dynamic.DIIServiceRefConfigContextImpl.prepareContext(DIIServiceRefConfigContextImpl.java:275)
        at com.sap.esi.esp.service.server.dynamic.DIIServiceRefConfigContextImpl.<init>(DIIServiceRefConfigContextImpl.java:59)
        at com.sap.esi.esp.service.server.dynamic.DIIContextCreatorImpl.createDIIServiceRefConfigContext(DIIContextCreatorImpl.java:18)
        at com.sap.engine.services.webservices.espbase.client.dynamic.configuration.DIIContextFactory.createDIIConfigurationsContext(DIIContextFactory.java:12)
        at com.sap.engine.services.webservices.espbase.client.dynamic.GenericServiceFactory.createService_NewInstance(GenericServiceFactory.java:368)
        ... 67 more
    Please help me about this.
    Thanks and Regards,
    Amit Basak

    Hi Amit,
    Create provider system in NWA -> SOA management -> System Connections. After ping is successful go to NWA -> Application Communication and select your DC and assign the provide system for your service configuration group.
    I hope it will works fine as we also did the same.
    - Pradeep

  • How to run my jar file on a webserver

    hello everybody,
    I've created a chat aplication which consists of a client-side and server-side. The client-side is an applet and is working fine. But i'm getting problem with the server-side. Actually, it is working fine on my local system and even in a local area network. But now, i want to put the server-side on a webserver. So, i want to know how can i do that. My server-side is a jar file "chatserver.jar" which i've developed using frame containers. I want to know also how to run the chatserver.jar on the webserver. Is it that i should have implemented jsp? Or javascript? coz my chatserver must be always running 24/7. It must not be available to user. users will chat through applets and the data will be sent to the server-side which will in turn control and recognise those data. Can anyone please help me in that issue.

    that was very kind of u for replying to me. thanks a lot. Well, the web software i'm running is nothing soo great but it's simply a chat server side application. In this application, i'm using a thread where my datagram socket will keep on receiving data from clients and this server side apllication must response to the client. For example, if a client has added a new room, or a new user has logged in, the server side must take care to inform all other clients that a new user has just logged in or a new room has been created. The main method is in the "chatserver.class". Then, i've combined all my classes including the chatserver.class into a jar file. When i click on the jar file on my local system or on the server of a local area network, it works beautifully. So, my server side application works like that. I have to click on the chatserver.jar once and nothing else. No other interaction with the applicaion. But my problem is how to run it on a web-server like apache. Or even if i upload this software on a website, how do i make it run? Shall i implement jsp codes? If yes, how to execute such jar file using jsp?
    here are part of the codes where my datagramsocket is receiving message from clients:
    public void run()
         while(thread!=null)
              byte[] recbuf=new byte[65536];
              recpacket=new DatagramPacket(recbuf,recbuf.length);
              try{
                   servsocket.receive(recpacket);
                   if(servsocket==null)
         byte[] bt=recpacket.getData();
         String recvmess = new String(bt, 0, recpacket.getLength());
         InetAddress clientaddress=recpacket.getAddress();
         int clientport=recpacket.getPort();
         chatcom=new chatcom(this,clientaddress,clientport,recvmess);
         try{
              thread.sleep(10);     
         catch(InterruptedException _INExc)      
    chatcom is another class which i've created to differentiate if the data received is a message, new room, new user, etc... I've created my own RFC to make those differences. Like i said above, if a client has created a new room, the chatcom class will recognise that a new room has to be created and will therefore send the new room created to all other clients. So, i want to know how to get my "chatserver.jar" run on a web server like apache or even on a website if i want to upload this software. Coz once it starts running, i dnt hav to close the application. I mean to say that this application will have to run 24/7. Do i have to execute it externally using jsp codes? Is there any way to get my application run on a webserver?

  • How to run a JAR file in Unix system?

    hi there
    ca anyone tell me how to run a JAR file in unix system or X window, thank you

    You want to create an executable JAR file? You do it in the following way.
    Create a manifest file such as manif.txt and the contents should contain
    Main-Class: foo
    assuming foo is the name of your main class. Then create the jar as follows
    jar cvfm foo.jar manif.txt foo.class
    I hope that helps you!
    you can find more info here http://java.sun.com/docs/books/tutorial/jar/

  • While executing a jar file I am getting an error

    while exec a jar file i am getting an error
    invalid file (bad magic number): Exec format error
    i tried to execute it with the commnad
    java -jar test.jar
    or by directly too
    ./test.jar

    Than tell me how to launch a jar file I tried different ways like
    java -jar MyJar.jar
    and
    MyJar
    and
    ./MyJar
    but its not worked

  • How To Access a jar file present outside the war file through a jnlp

    Aoa
    I m new to this forum
    I m having problem with my jnlp file
    i want to know is there any way to access a jar file through jnlp.The problem is that my jnlp file is present in the war file
    and i want to know how to acess a jar file through this jnlp.The scenerio is as below
    I m using ear file on jboss.Its hirerchy is as
    -PAN-war.war
    -launch.jnlp
    -PAN-app-client.jar
    my jnlp file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/" href="PAN/launch.jnlp">
    <information>
    <title>PanEmirates</title>
    <vendor>M Fazal Ur Rehman</vendor>
    <description>PanEmirates</description>
    <description kind="short">PanEmirates</description>
    <homepage href=""/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="PAN-app-client.jar" download="eager"/>
    <jar href="lib/javafxrt.jar" main="true" download="eager" />
    <jar href="lib/Filters.jar" download="eager"/>
    <jar href="lib/javafx-netbeans-fxuserlib.jar" download="eager"/>
    <jar href="lib/swing-layout-1.0.3.jar" download="eager"/>
    </resources>
    <application-desc main-class="net.java.javafx.FXShell">
    <argument>pan.Main</argument>
    </application-desc>
    </jnlp>
    when i run launch.jnlp file it says unable to download resource http://localhost:8080/PAN/PAN-app-client.jar
    how to access this jar file
    Any help or comment would be highly appreciated
    Regards
    M Fazal Ur Rehman

    Excellent question. I don't see any client-jar in your EAR file structure. So I am assuming you are writing a separate client application which will talk to the ejbs deployed as part of this EAR. You need to do the following:
    Write another EAR file with the following structure:
    ear:
    META-INF/application.xml
    util.jar
    client.jar
    client.jar should have a META-INF/MANIFEST.MF and that should contain Class-Path:util.jar and value for Main-Class attribute.
    Now deploy this new ear to your application server and execute it using Application Client Container that comes with your app server.
    If you don't want to write another EAR file, then bundle th client.jar in your original EAR file.
    Points to note are:
    you have to repackage util.jar again inside this ear file.
    For portability reason, you should use Class-Path manifest entry in client.jar. Refer to http://java.sun.com/j2ee/verified/packaging.html and J2EE platform spec section #8.2.
    Hope this helps,
    Sahoo

  • How to import external jar file

    i am using bcprov-jdk14-124.jar file for my project. i can import this jar file through eclipse project properties but this is not worklng when i create jar file for my project. This is worked in eclipse only. i want to use that jar file in my project current path. so any body help me how to import this jar file? ( i am using mac os to develop java project )

    You need to specify the classpath when you execute it outside of Eclipse.
    Kaj

  • How to run a jar file

    hi
    can anybody tell me how to run a jar file in java,is there any need to unzip a jar file before running it?
    Thanks in advance.

    Set the classptha, if you want to run it by double clicking.
    I assume that you know, how to set the classpath.I though that if it is an executable jar, the classpath environment variable will be completely ignored. Are you saying something to the contrary?

Maybe you are looking for

  • When i close the window if press pressed next to the closure and returned again press not work

    When i close the window if press pressed next to the closure and returned again press not work

  • Pie chart not getting

    Hai Im not getting the pie chart .what i did was i created a query in Bex. And then i publish the query from Bex-Analyzser (Business Explorer -> Tools -> Launch in WebBrowser). Then i got my report in Web . Then i went to "Graphical display" and i se

  • [Solution] Compiling multiple C/C++ files

    I've lost about 6 hours reading forums and googling to find out how to compile project with multiple .cpp files into one .swf. I've seen different errors (Undefined sym, etc.) and tried different solutions. So, I'm posting this to help anybody who wi

  • " write access for your iTunes Media folder"

    Hello, My iTunes all of a sudden started to gave me this error when I tried to update my iPhone Apps: *iTunes couldn't download your purchase* *You don't have write access for your iTunes Media folder or a folder within it. Change permissions (in the

  • Gaussian Blur ruins my image

    Hi For some reason I am getting this problem where I cut out an image, use gaussian blur and then my image gets all messed up, with squaires, circles and lines starting to appear on the layer of the cut out image. (What is weird is I wasnt even using