How can i launch another java application using Runtime class?

I created a java process which invokes another java application called Launch as shown below,
Process p=Runtime.getRuntime().exec("java -classpath=C:\\Program Files\\bin\\nettools\\ui\\updates Launch");
But it is not working...can any one help me on this?
Edited by: deepakchandaran on Sep 20, 2007 7:10 AM

You could search the forum and Google.
it has been answered before.
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

Similar Messages

  • Can we run a java application using Runtime.exec()?

    Can we run a java application using Runtime.exec()?
    If yes what should i use "java" or "javaw", and which way?
    r.exec("java","xyz.class");

    The best way to run the java application would be to dynamiically load it within the same JVM. Look thru the class "ClassLoader" and the "Class", "Method" etc...clases.
    The problem with exec is that it starts another JVM and moreover you dont have the interface where you can throw the Output directly.(indirectly it can be done by openong InputStreams bala blah............). I found this convenient. I am attaching part of my code for easy refernce.
    HIH
    ClassLoader cl = null;
    Class c = null;
    Class cArr[] ;
    Method md = null;
    Object mArr[];
    cl = ClassLoader.getSystemClassLoader();
    try{
         c = cl.loadClass(progName.substring(0,progName.indexOf(".class")) );
    } catch(ClassNotFoundException e) {
    System.out.println(e);
         cArr = new Class[1] ;
         try{
         cArr[0] = Class.forName("java.lang.Object");
         } catch(ClassNotFoundException e) {
         System.out.println(e);
         mArr = new Object[1];
         try{
         md = c.getMethod("processPkt", cArr);
         } catch(NoSuchMethodException e) {
         System.out.println(e);
         } catch(SecurityException e) {
         System.out.println(e);
    try {            
    processedPkt = md.invoke( null, mArr) ;
    } catch(IllegalAccessException e) {
              System.out.println(e);
    } catch(IllegalArgumentException e) {
              System.out.println(e);
    }catch(InvocationTargetException e) {
              System.out.println(e);
    }catch(NullPointerException e) {
              System.out.println(e);
    }catch(ExceptionInInitializerError e) {
              System.out.println(e);
    }

  • How to Start/Launch another WD application using a link.

    Hi, I've been trying to see if there's an official way that I can launch another WD application using a link from within an application where the applications are not in the same deployable object.
    P.S.  I've seen the other thread of how to do it when the applications are within the same deployable object.
    Thanks in advance as always,

    Hi Michael,
    of course it does, so the question should be:
    "Hey, how do it get the application URL of a WD application without hardcoding the server name, port or whatever?"
    This is simple:
       * Return is the application URL for the specified <code>deployableObjectPart</code> with appended 
       * URL parameters given by <code>urlParameters</code>. All key/value pairs in the map must
       * be of type java.lang.String.
       * @param deployableObjectPart a deployable object part representing a Web Dynpro application
       * @param urlParameters key/value pairs added as URL parameters; they must be of type String
       * @return the application URL for the specified <code>deployableObjectPart</code> with appended 
       * URL parameters given by <code>urlParameters</code>
       * @throws WDURLException if the URL couldn't be generated
       * @see com.sap.tc.webdynpro.services.sal.url.api.WDURLGenerator#getApplicationURL(WDDeployableObjectPart)
      public static String getApplicationURL(WDDeployableObjectPart deployableObjectPart, Map urlParameters) throws WDURLException {
        return AbstractManager
          .getServerPlatformImplementation()
          .getURLGeneratorFactory()
          .getURLGenerator()
          .getApplicationURL(deployableObjectPart, urlParameters);      
    or if you would like to get it load balanced:
       * Return is the workload balanced application URL for the specified <code>deployableObjectPart</code> with appended 
       * URL parameters given by <code>urlParameters</code>. All key/value pairs in the map must
       * be of type java.lang.String.
       * @param deployableObjectPart a deployable object part representing a Web Dynpro application
       * @param urlParameters key/value pairs added as URL parameters; they must be of type String
       * @return the workload balanced application URL for the specified
       * <code>deployableObjectPart</code> with appended URL parameters given by <code>urlParameters</code>
       * @throws WDURLException if the URL couldn't be generated
       * @see com.sap.tc.webdynpro.services.sal.url.api.WDURLGenerator#getWorkloadBalancedApplicationURL(WDDeployableObjectPart)
      public static String getWorkloadBalancedApplicationURL(WDDeployableObjectPart deployableObjectPart, Map urlParameters) throws WDURLException {
        return AbstractManager
          .getServerPlatformImplementation()
          .getURLGeneratorFactory()
          .getURLGenerator()
          .getWorkloadBalancedApplicationURL(deployableObjectPart, urlParameters);     
    Before i forget it to mention, these are two methods of the WDURLGenerator API. There are others where you don't have to specify the deployableObjectPart, you can use DPO name and name of application as parameters instead.
    Hope that helps.
    Best regards
    Stefan
    PS: This was my 2nd attempt, i hope i got you right now...

  • How can I Launch a Java application that I have written using an icon

    I have just finished writing a Messaging system like Ms Outlook written completey in Java. To run my application , I would normaly type: java and then the class containing the main method eg java LogonFrame.
    How can I launch my application by just clicking on an icon ?.
    How can I also package and install this application the way most conventional application are packaged and installed. Do we have a sort of "java Installer" ?.
    Thank you.

    Just make a .bat file. Open notepad, type something like
    @echo off
    javaw -classpath %~d0%~p0 Package.MainClass %1
    Now make a shortcut to this file. Rightclick the shortcut and select start in "minimized". Thats it...
    Nille

  • How can i built a java application using java debug class on Log4J

    Hi,
    As java API support the MethodEntryEvent, using which I can get the automatic logging statements when the method is entered or exited as HelloExample.main(with argument type).
    Where HelloExample is the class name.
    Main is the method entered with its argument types.
    In some cases I have the o/p as
    -- VM Started --
    ====== main ======
    main -- HelloExample
    callerMethod -- HelloExample
    ====== main end ======
    -- The application exited --
    By using Log4J is there any possibility of getting these sort of o/p along with the loggers supported by Log4J. i mean to say can i built an java application which supports the MethodEntryEvent and MethodExitEvent from java API and also uses the Log4J debugging. I took an e.g. trace example, which (in J2SE 1.4.x or 5.x) will be found in $JAVA_HOME/demo/jpda/examples.jar and unpacking it by
    jar -xvf $JAVA_HOME/demo/jpda/examples.jar i found the com/sun/tools/example/trace/Trace.java and passed the class constructed with logger taken from Log4J. In this case the logging message is displayed on the console. As per the requirement i need to transfer the whole o/p to an output file along with Log4J logger statements. in this case i should not give any command in the cosule except compiling and executing the programme. the programm also should able to run without the main() as i need to integrate Log4J with an application and the code must me application server independent. i need the output as i got using MethodEnteryEvent (shown as above) in case of java application built using Log4J.
    Can any one help me in this regard. can any one give me some suggestion or any programme of this sort. All suggestions are welcomed.
    Thanks & Regards,

    hi,
    can someone help me how to implement logging for method entry parameters and
    method exit return value.
    can someone help me how to use log4j and integrate it to the method entry
    logging and method exit logging.
    Here what i need is without writing the log statements for the method entry and
    method exit i need to log it to the file
    along with other log4j debug statements i provide in the file.I should be able
    to configure whether to enable/disable the logging
    for method entry and method exit. In method entry i should be able to log the
    parameters the method take and in method exit
    i should be able to log te return value to the log file, before the method is
    returned to the callee.
    i hope i am clear
    Thanks in advance.

  • How  can I start my Java Application using double-click  in Windows XP?

    I hava developed an editor in java. The file made by this editor is saved as the .cte format. so, I need to associate this file with the editor, which means that when you double click the .cte file ,this file will be opened in the editor just like the notepad.
    I know that Jbuider has used the JNI to achieve this way to open a project. So, will you kindly tell me the details about this technique or give me some document? My E_Mail is [email protected]
    Best Regards,
    Maria

    I think this can be done from a batch file which you can execute when you install your application.
    There are two commands which you are interested in, and they are:
    assoc - Displays or modifies file extension associations.
    ftype - Displays or modifies file types used in file extension associations.
    You should use assoc to associate an extension with a file type, and ftype to associate the file type with an application.
    E.g. jar is associated with this on my machine:
    .jar=jarfile (from assoc)
    jarfile="C:\Program Files\Java\jre1.5.0_06\bin\javaw.exe" -jar "%1" %* (from ftype)
    Kaj

  • How can i start my java application using double-click in WindowsXP?

    i hava developed an editor in java. The file made by this editor is saved as the .cte format. so, I need to associate this file with the editor, which means that when you double click the .cte file ,this file will be opened in the editor just like the notepad.
    I know that Jbuider has used the JNI to achieve this way to open a project. So, will you kindly tell me the details about this technique or give me some document? My E_Mail is [email protected]
    Best Regards,
    Maria

    Must you use native code? Can't you do what I said in your other thread?
    http://forum.java.sun.com/thread.jspa?threadID=699476
    Kaj

  • How can i let my java application closes the other opened windows

    how can i let my java application closes the other opened windows: like any other Microsoft Internet Explorer windows ... provided that my java application is not the one i used to open those other windows.... thanks in advance

    you'll have to use JNI to access the windowAPI
    then you need a list of window handles ... I think there was a function called getWindow and in order to close them you use sendMessage .... for details check out msdn (microsoft developer network)
    somwhere I saw a tool called JUtil, which might help you getting started on accessing the win api from java
    regards
    Spieler

  • How can I run a java-application on starting of Windows 2000

    How can I run a java-application without any user on starting of Windows 2000?
    For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway.
    How can I do that?

    Hi, you have to put it in a Windows service.
    To do this you have a program, Srvany.exe that allow to insert a .exe or .bat program in a Windows service.
    For example, i develop a program, TomcatGuardian and i put it in a service because i need to run it in a server without Administrator logged in.
    Regards,
    Ivan.

  • How can i get a java application

    how can i get a java application on my mac pro?

    I'm not sure I understand the question. If the application is a standalone applet, you download it as you would any other application or file. If the applet is embedded in a web site, just go to the appropriate web page.
    If you can provide more specifics about what it is you are trying to download/accomplish, perhaps we can be of more specific assistance.
    Regards.

  • How can I debug webdynpro java application?

    hi,
    How can I debug webdynpro java application?
    Thanks

    Check this document
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d0cb32c5-36a7-2910-2c9b-ba4a5bbdbb56
    Also check this sdn thread Re: DeBugginng The WebDynPro Application particularly shailesh kumar posting
    /padmanaban
    Edited by: Padmanaban on Sep 26, 2008 1:55 AM

  • My iTunes account has been disabled.  How can I start another iTunes account using same email address

    My iTunes account has been disabled.  How can I start another iTunes account using same email address?

    Why would you start another account?
    This will only cause problems

  • Launching another VM instance using Runtime.exec()

    Hi,
    I have two separate Swing applications, say A and B. I need to launch B from A using Runtime.exec() - essentially I am launching another VM instance from one VM. I am encountering strange problems - B's main window comes up, but GUI doesn't update; sometimes B comes up and GUI updates, but huge memory leaks happen. All the problems with B go away once A is shut down. It almost looks like both the instances of VM are sharing (or competing for) the event thread. Any comments will be of great help. Thanks.
    note: There is no problem launching B if A is a console java application (i.e. no Swing GUI).

    I have recently had the same problem, especially with the part where it seems like the two applications are sharing or competing for the same event thread. Sometimes my application B hangs like it is stuck waiting for an event. Sometimes I can get it to unhang by moving the app window around or minimizing it. If it does break free, all the queued events occur in rapid succession. Anybody have any clue what's going on here? It's pretty annoying.

  • How to capture output of java files using Runtime.exec

    Hi guys,
    I'm trying to capture output of java files using Runtime.exec but I don't know how. I keep receiving error message "java.lang.NoClassDefFoundError:" but I don't know how to :(
    import java.io.*;
    public class CmdExec {
      public CmdExec() {
      public static void main(String argv[]){
         try {
         String line;
         Runtime rt = Runtime.getRuntime();
         String[] cmd = new String[2];
         cmd[0] = "javac";
         cmd[1] = "I:\\My Documents\\My file\\CSM\\CSM00\\SmartQ\\src\\E.java";
         Process proc = rt.exec(cmd);
         cmd = new String[2];
         cmd[0] = "javac";
         cmd[1] = "I:\\My Documents\\My file\\CSM\\CSM00\\SmartQ\\src\\E";
         proc = rt.exec(cmd);
         //BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
         BufferedReader input = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         while ((line = input.readLine()) != null) {
            System.out.println(line);
         input.close();
        catch (Exception err) {
         err.printStackTrace();
    public class E {
        public static void main(String[] args) {
            System.out.println("hello world!!!!");
    }Please help :)

    Javapedia: Classpath
    How Classes are Found
    Setting the class path (Windows)
    Setting the class path (Solaris/Linux)
    Understanding the Java ClassLoader
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

  • How can I interface a Java application which is not running under NetDynamics, to use the EJBs in a NetDynamics application?

    One of them uses Enterprise Java Beans implemented with a SUN NetDynamics application server. The other is a straight Java application. Ideally I want the second application to remotely invoke methods on the existing Java beans, so the existing business logic will not be duplicated.
    This would seem to be simple, but NetDynamics appears to substitute some proprietary code for part of the EJB interface, and it is not immediately obvious how to let "foreign" java programs access the beans.
    I would appreciate it if anyone is able to provide any information on how to achieve this. If you know of any sample code that I could look at, that would be a help too. This may (or may not) be known to SUN as a "stand alone java client".

    hi,
    can someone help me how to implement logging for method entry parameters and
    method exit return value.
    can someone help me how to use log4j and integrate it to the method entry
    logging and method exit logging.
    Here what i need is without writing the log statements for the method entry and
    method exit i need to log it to the file
    along with other log4j debug statements i provide in the file.I should be able
    to configure whether to enable/disable the logging
    for method entry and method exit. In method entry i should be able to log the
    parameters the method take and in method exit
    i should be able to log te return value to the log file, before the method is
    returned to the callee.
    i hope i am clear
    Thanks in advance.

Maybe you are looking for

  • Drivers for Lexmark x5150

    I am trying to download the drivers for a hand-me-down Lexmark x5150. http://downloads.lexmark.com/static/229-1-0-133.html When I download the: Description: Driver for Mac OS 9.x.x and Mac OS X OS: Mac OS X Filename: X5100 Series Installer" It comes

  • Why can't I download movies in original english language form the Austrian store?

    I am using my id with the Austrian itunes store but would like to download the movies with original spoken english language. If I change my country, my ID is not valid for purchases. How can I get my movies in original language?

  • L540 Middle click not working

    Hello today I received my L540 and I'm installing all the drivers at the moment. After I installed the trackpad/point drivers I disabled the trackpad. But now I noticed that the middle mouse button isn't working. How can I fix this issue? Also is the

  • Create a report from ABAP Query (SQ02)

    Hi, guys. I must create a SE38- report that simulate the selection of a query in sq02. How can I do for call the query in my own report? (I know all...user group, name, structure name) I can do other elaboration from data after the calling of the que

  • Problem with 2 way SSL for JMS

    Finally, there is some progress on my JMS over SSL (2 way with JNDI). I am able to send/receive JMS messages but there is an exception in Weblogic server log (see attached). Let me summarise all the steps involved: (I have referred this doc http://ja