How to start java.exe from a java program in windows ?

Hi,
I did like to know, if its possible to run java.exe from a java program on windows ? The java.exe should be visible from checking the processes that are currently running using the Task Manager on windows.

Runtime.getRuntime().exec("java Sample");

Similar Messages

  • Starting notepad.exe from within Java app?

    Is it possible to start notepad.exe from within a java app to display a log file (for instance)?

    search the forum for Runtime.getRuntime()

  • How to make a .exe from a java .class

    Hi All,
    I want to write a scheduler program in Java and that class file I want to install as a service in windows scheduler. So for that purposr I need an executale right?
    How can I convert a java class to a .exe program.
    Thanks and Regards
    KK

    No need to create exe file. U can covert into .bat file. With help of windows scheduler u can run the file as per ur required.

  • Starting IExporer.exe from java with J9 in an IPAQ

    Hi all,
    I'm trying to run IExplorer.exe from a java program in a IPAQ with j9 cvm.
    I did try it in Windows 2000 and it works fine but when running it in the IPAQ with Windows CE it throws an exception.
    Looks like the Exception is thrown because it can not find the file, but I think I'm writing the correct path and file name.
    Here is the code and the exception. Can any one try it and tell me what Am I doing wrong.
    Thanks a lot.
    String s = "\\Windows\\iexplore.exe";
    //String s = "\"C:\\Program Files\\Internet Explorer\\IEXPLORExx.EXE\"";
    try
    System.out.println("s: " + s);
    Runtime runtime = Runtime.getRuntime();
    Process p = runtime.exec(s);
    catch(IOException ioEx)
    ioEx.printStackTrace();
    java.io.IOException: Unable to start program
    Stack trace:
    com/ibm/oti/lang/SystemProcess.create([Ljava/lang/String;[Ljava/lang/String;L
    java/io/File;)Ljava/lang/Process;
    java/lang/Runtime.exec([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)L
    java/lang/Process;
    java/lang/Runtime.exec(Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Lj
    ava/lang/Process;
    java/lang/Runtime.exec(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Proce
    ss;
    java/lang/Runtime.exec(Ljava/lang/String;)Ljava/lang/Process;
    com/gestorPosicion/inicio/InicioCliente.main([Ljava/lang/String;)V                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The problem is that on PocketPC you cannot redirect input or output and the exec() call will not work as expected so it instead throws the exception to indicate this doesn't work on PocketPC.

  • How to terminate an exe from Java

    Hi Everyone
    Can anyone let me know the code to how to terminate an exe from Java
    I run an exe using
    Runtime.getRuntime().exec(dialog); //where dialog is a string (pointing to an exe)
    Now i need to kill this exe
    How do i do this in java
    Any help is highly appreciated
    Thanks!

    getafix14 wrote:
    I run an exe using Runtime.getRuntime().exec(dialog); //where dialog is a string (pointing to an exe)
    Now i need to kill this exe
    How do i do this in java
    ejp wrote:
    Process.destroy();
    And don't forget to take a swig of magic potion first.
    Winston

  • How can i modify exe resource in java?

    How can i modify exe resource in java?
    No jni
    thx.

    if it is .NET code decompilation is possible if, and only if the code is not Packed by protections!
    but if the EXE file is native and created by VB 6.0,C/C++,Delphi,... it is not possible to obtain source code from it, not as far as i know.
    (some program does it , but the returned source code is as useful as its assembly code in debugger).
    if decompilation was that easy then Reverse Engineering was no longer needed!
    What program it is so that can put two exe file into each other ?
    the program you seen might put second exe file into its DATA section then when it executes ,
    it jumps to data section of itself!
    otherwise it is not possible.
    Good luck.
    Edited by: 0mega7 on Apr 5, 2008 8:27 AM
    Edited by: 0mega7 on Apr 5, 2008 8:29 AM

  • How to call a Java class from another java class ??

    Hi ..... can somebody plz tell me
    How to call a Java Class from another Java Class assuming both in the same Package??
    I want to call the entire Java Class  (not any specific method only........I want all the functionalities of that class)
    Please provide me some slotuions!!
    Waiting for some fast replies!!
    Regards
    Smita Mohanty

    Hi Smita,
    you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
    e.g.
    you have developed A.java and B.java, both are in same package.
    in implementaion of B.java
    class B
                A obj = new A();
                 //to access A's methods
                 A.method();
                // to access A's variable
                //either
               A.variable= value.
               //or
               A.setvariable() or A.getvariable()

  • How to create the exe file for java project.

    How to create the exe file for java project.
    am done the project in java swing , i like to create the project in exe format, so any one help for me,
    send the procedure for that.
    thanking u.

    How to create the exe file for java project.Have you ever heard of google? I pasted your exact "question" into a google search:
    http://www.google.com/search?q=How+to+create+the+exe+file+for+java+project.
    and got several useful links.
    Better search terms might yield even better results.
    Sheesh.

  • Win2000 NoClassDefFoundError running java.exe from DOS prompt

    I am using Windows 2000 with J2SE v 1.3.1_02 and have a problem when I run java.exe from the command line for classes that are defined to be in a package. I can both compile and run this program from the TextPad editor but when I run it from a DOS prompt I get the error "Exception in thread "main" java.lang.NoClassDefFoundError: MyClass"
    My CLASSPATH is set to D:\
    The files MyClass.java and MyClass.class are in the directory D:\MyProject
    here is the source:
    package MyProject;
    public class MyClass
         public static void main(String[] args)
              System.out.println("MyClass main");
    Note that if I comment out the package statement and add "." to CLASSPATH then it runs from the DOS prompt. Why does the program run from inside TextPad but not from the DOS prompt? Seems to be some type of bug in java.exe on Windows 2000 when the keyword package is used.

    It turns out that if you use the main method in a class that declares the package statement you need to use the fully qualified name to run the program. Using this statement works for this problem:
    java MyProject/MyClass
    the forward slash is required even though is a Windows system.

  • How to create the exe files for java application

    How to create the exe file for java application?
    got any software to do that?
    Thanks

    In terms of converting java applications into exe files, there are 3 schools of thought:
    1) Instead of converting it to an exe, convert it to a jar file. Jar files are more portable than exe files because they can be double-clicked on any operating system. The caveat is that a Java interpreter must be installed on the target computer for the double-clicking to work.
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/
    2) Create an exe launcher that, when double-clicked, attempts to find a Java interpreter on the local computer and launches the Java application. The exe file is still double-clickable but whether your java application runs depends on whether a Java interpretor is installed on the target computer.
    http://www.sureshotsoftware.com/exej/
    http://www.objects.com.au/products/jstart/index.jsp
    http://www.duckware.com/products/javatools.html
    http://www.ucware.com/jexec/
    http://www.rolemaker.dk/nonRoleMaker/javalauncher/
    http://www.jelude.cjb.net/
    http://thor.prohosting.com/~dfolly/java/index.html
    3) Create an exe launcher that bundles a Java interpretor. Same as above but when the exe file is double-clicked, it searches for a Java interpreter and if one is not found, it installs one on the target computer. The caveat is that the exe file would have an overhead of 10 MB in size for the interpreter.
    http://www.excelsior-usa.com/jet.html (evaluation version available)
    4) Convert the Java application into a native exe file. The caveat is that if you use Swing for your GUI, it won't be converted. Also this option is still somewhat experimental.
    Can't think of any free options right now.

  • How to compile and run a .java file from another java program

    hello,
    can any one tell me how to compile and run a *.java* file from another java program which is not in same directory?

    Well a smarter way of implementing this is by using a solution provided by Java Itself.
    If you are using J2SE 6.0+ there is an in built solution provided along with JDK itself and inorder to go ahead with solution the below are set of API which you;d be using it for compiling Java Programs (Files)
    http://java.sun.com/javase/6/docs/api/javax/tools/package-summary.html
    How do i do that ??
    Check out the below articles which would help you of how to do that
    http://www.ibm.com/developerworks/java/library/j-jcomp/index.html
    http://www.javabeat.net/javabeat/java6/articles/java_6_0_compiler_api_1.php
    http://books.google.com/books?id=WVbpv8SQpkEC&pg=PA155&lpg=PA155&dq=%22javax+tools%22+compiling+java+file&source=web&ots=XOt0siYe-f&sig=HH27ovuwvJgklIf8omTykUmy-eM
    Now once we are done with compilation.In order to run a Specific class all you ought to do is create an object and its specific methods of a specified class included in the CLASSPATH which you can manage it easily by usage little bit reflections.
    Hope that might help :)
    REGARDS,
    RaHuL

  • Trying to compile a .java file from another .java file

    Hello,
    I'm trying to compile a .java file from another .java file using Runtime.exec...
    String c[]=new String[3];
    c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
    Process p=Runtime.exec(c);
    If anyone can help me in atleast getting the command prompt when Runtime.exec("cmd.exe") is executed...that would be great...I tried out notepad.exe, calc, explorer instead of cmd.exe...all the commands display their respective windows..except cmd.exe...the command prompt doesnt appear...
    Please help me ASAP....
    Thanks for your help in advance...
    Regards.
    AKhila.

    try this. ur code will be compliled and will get .class file. but console won't appear. is it a must for u?
    public class Exec{
         public static void main(String a[]) throws Exception{
              String c[]=new String[3];
              c[0]="cmd.exe"; c[1]="/c" ; c[2]="javac Hello.java";
              Process p=Runtime.getRuntime().exec(c);
              // or Runtime.getRuntime().exec("javac Hello.java");

  • Hello, sombody knows how to start MS Excel from LabView (version 8.2)? Thanks

    Hello, sombody knows how to start MS Excel from LabView (version 8.2)? Thank you in advance.
    Regards Robert

    In the example finder  ">Help>Find Examples >>search for Excel", you'll find a sample program called "ActiveX Event Callback for Excel".
    It opens the Excel Application..  You can build on this to open/create new worksheet(s), etc.
    RayR
    Message Edited by JoeLabView on 06-20-2007 08:21 AM
    Attachments:
    OpenExcel.PNG ‏34 KB

  • Calling a Java Subpackage from a C program.... fails

    I am having alittle bit of trouble calling a java subpackage from my C program. I can call a package ok but not a subpackage.
    My directory path is c:\com\phoenix_systems_inc
    My CLASSPATH=.;c:\com;
    In the c:\com\phoenix_systems_inc directory is my FundsgClient.class
    The fundsgClient.java has a package declaration of
    package com.phoenix_systems_inc;
    within the fundsgClient.java is class:
         public synchronized static String setValue (String str) {
         String a = "You passed: " + str;
         return a;
    ======================================
    in my C program I have
    options[0].optionString = "-Djava.class.path=c:\\com\\";
    cls = env->FindClass("/phoenix_systems_inc/com.phoenix_systems_inc.FundsgClient");
    I think that I am over declaring the path in FindClass.

    nope;; that is what I had initially;
    My CLASSPATH is CLASSPATH=.;c:\com;
    ==================================C program code
    memset (&vm_args, 0, sizeof(vm_args));
    vm_args.version=JNI_VERSION_1_2;
    vm_args.options = options;
    vm_args.nOptions = 1;
    options[0].optionString = "-Djava.class.path=c:\\com";
    vm_args.ignoreUnrecognized = TRUE;
    res = JNI_CreateJavaVM(&jvm,(void**)&env,&vm_args);
    if (res < 0)
    fprintf(stderr, "Can't create Java VM\n");
         return 0;
    cls = env->FindClass("com/phoenix_systems_inc/FundsgClient");
    ===== is the java class code ==========
    package com.phoenix_systems_inc;
    import org.apache.log4j.Logger;
    import org.apache.log4j.PropertyConfigurator;
    import gnu.cajo.invoke.Remote;
    import gnu.cajo.utils.extra.Xfile;
    * Fundsg RMI Client
    * @author agesite
    * @version 1.0
    public class FundsgClient {
    static {
    PropertyConfigurator.configure("FundsLog.properties");
    // Log4j logger
         private static Logger log = Logger.getLogger("PhoenixClient");
    // Get RMI Server Hostname
    private static final String host = PhoenixClientProperties.getInstance().
    getProperty("PhoenixRMIServer");
    private static String port = "1198";
         * request
         * @param requestStr Request String
         * @return String Response String
         * @throws Exception
         public synchronized static String request (String requestStr) throws Exception {
              // Serialized object
              RequestObject requestObj = new RequestObject();
              requestObj.setRequest(requestStr);
              if (log.isDebugEnabled()) {
                   log.debug("Client Request: " + requestStr);
              System.out.println("//" + host + ":" + port + "/fundsgServer");
              Object object = Remote.getItem("//" + host + ":" + port + "/fundsgServer");
              String response = (String) Remote.invoke(object, "nativeFundsg", requestObj.getRequest());
              if (log.isDebugEnabled()) {
                   log.debug("Server Response: " + response);
              return response;
         * xferFile
         * @param sourceFile
         * @param destFile
         * @throws Exception
         public synchronized static void xferFile (String sourceFile, String destFile) throws Exception {
              try {           
                   Object xf = Remote.getItem("//" + host + ":" + port + "/xfileFunds");
                   // remoteInvoke = true means transfer can be performed from
    // server to client and vice versa
    Xfile.remoteInvoke = true;
                   Xfile.fetch(xf, sourceFile, destFile);
              } catch (Exception e) {
                   if (log.isDebugEnabled()) {
                        log.debug("Xfile.fetch exception: " + e);
         public synchronized static String setValue (String str) {
         String a = "You passed: " + str;
         return a;
    }

  • How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?

    How can I keep lion from generating .DS_Store files on windows network partitions, but not disable it for all network partitions?  I am fimilar with changing the setting for all network partitions(defaults write com.apple.desktopservices DSDontWriteNetworkStores true), but that is undesirable when I connect my laptop to my home network. A preferable solution would be where I could control the writing of these files based on disk format (NTFS vs HFS+).

    Go to MacUpdate or CNET Downloads and search for ds_store. There are numerous utilities for preventing them from being transferred to Windows systems.

Maybe you are looking for

  • Poor Cellular Connection after iOS 8 Upgrade

    Hi Apple Support, I have upgraded my iPhone5 to iOS 8 and after the upgrade i am getting very poor Cellular connectivity. Talking in terms of the "4 small Circles" adjacent to Carrier name . it used to be all 4 circles always. but after the upgrade i

  • Error while creating service PO by BAPI_PO_CREATE1

    Hi, I am trying to create a service PO using the BAPI_PO_CREATE1 with reference to service PR and I am getting an "In case of account assignment, please enter acc. assignment data for item" for which i found so many threads but none had resolved this

  • Populating Swing JList using SQL Database

    Sup peeps, im trying to to populate a JList using the entries in a table in a database i created. package networks; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.PrintWriter; import java.sql.*; public class Contesta

  • Process Chains in BPC

    Hello Gurus, While creating a process chain, I see that we have to use the BPC delivered Process Types.  One of these is "Modify Dynamically".  However, I noticed that in the variant for the "Modify Dynamically", we do not specify any parameters (bas

  • Planning on getting first iPhone

    Hi, I was planning on getting my first iPhone, but I'm not quit sure on how everything works. First, do I go to the apple store or at&t store first? Do I need some type of proof that I'm an at&t customer? Second, once I get the phone, do I have to ta