How to run other windows .exe program in Java code?

Hello!
In C language we can use system() function to run a OS prog,
but which function(method) can we use in java?

Not a top programmer here, just happen to like to play with funny ideas.
I'm not sure how you can get the installation directory, but you can obtain the OS type by using
System.out.println(System.getProperty("os.name"));
Then maybe you deduce the directory from there? For the list of properties available try this:
System.getProperties().list(new java.io.PrintStream(System.out));

Similar Messages

  • How to run other sline.exe in forms

    Dear sir,
    I have one package which is developed in c or c++ dosbased. when i run through dos prompt it show s the new windows and i have press f1 key and accpect the data from com port and accecpt the data and write to x.file . then i am taking this data by writing text.io function and code.
    I need how to run this exe file in forms
    please guide me
    regards
    Mathapati.C.K.

    Have you tried the "host" command? Check the help for info.

  • How to run and control any program by java

    hi everyone ,
    I wonder that how to execute and control some menus or how to use some property of any program by java, not for the whole program, it's just only a few features of program.
    Is there any idea?
    if it's impossible to do with java , how can I do it? which way?
    thanks a lot..

    No. Applications have to be specifically built to be able to be controlled by other programs; for example office applications allow you to communicate with them through a special protocol. To be able to communicate you need to know the protocol and write specific code for specific tasks.
    The software world is not as simple as they show in movies, where hackers just press two buttons and take control over entire buildings and applications.

  • How to run a command prompt " command " through java code

    hi all,
    There is a command
    "java -jar selenium-server.jar -interactive"
    which i am running through command prompt after going to D:\MyFolder\Examples .
    i want to execute this command using java code .please help

    This has already been answered in your other two threads on this topic - http://forum.java.sun.com/thread.jspa?threadID=5221221&messageID=9898287#9898287 and http://forum.java.sun.com/thread.jspa?threadID=5221223&messageID=9898290#9898290.
    For some reason you don't want to read the reference that tells you exactly how to do what you want and how to avoid the pitfalls - http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .

  • I am trying to reinstall Windows on my macbook pro.  I downloaded the support files and Windows 7 iso file to a USB drive.  However, when I try to run the setup.exe program I get the message "this program cannot be run in DOS mode."

    I am trying to reinstall Windows (would not launch).  I removed the partition and started over.  I downloaded the support files and Windows 7 iso file to a USB drive.  However, when I try to run the setup.exe program I get the message "this program cannot be run in DOS mode."  I was successful before, what am I doing wrong this time?

    Try a restart.
    If that doesn't fix the problem, shut down the computer and then power it back up. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application unistaller. For each disable/delete, you will need to restart if you don't do them all at once.
    Safe Mode
    Safe Mode - About
    General information.
    Isolating issues in Mac OS X
    Troubleshooting Permission Issues
    Step by Step to Fix Your Mac

  • How do I run a windows pps program on my Iphone

    How do I run a windows pps program on my Iphone?

    I take you are asking about Microsoft Powerpoint here.
    If so it can't by run on an iPhone since there is no iOS version of Powerpoint available.
    A search of the App Store in iTunes will reveal that are bunches of apps that will work with Powerpoint on the iPhone.
    Allan

  • How can i run a windows based program on mac book pro

    Can I run a windows based program on mac book pro mountain lion 10.8.4

    You can use bootcamp to install windows natively on the hard drive.  You then choose which OS you wish to use at startup - OS X or Windows.
    You can also install Windows in a virtual machine - Parallels or VMWare Fusion - and run it simultaneously with OS X (a virtual machine is just a PC emulated in software, and you install and run windows in the emulated machine hardware).

  • How to run an external .exe file from an indesign pluging

    Hi,
          Suppose if I have written an separate application in C++ (.exe file) & need to run it from an indesign pluging(as if a service in windows). have you provided that facilities in your SDK? if it's please let me know how to run an external .exe file from a indesign pluging.
    Thanks,

    I'm actully writing data in PMString to a external txt file.
    another question..
    if i want to execute an action when the ok button is cliked how can i do it?
    whe i add a button(widget) i know how to handle it. please see my code.
    // Call the base class Update function so that default behavior will still occur (OK and Cancel buttons, etc.).
    CDialogObserver::Update(theChange, theSubject, protocol, changedBy);
    do
    InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());
    ASSERT(controlView);
    if(!controlView) {
    break;
    // Get the button ID from the view.
    WidgetID theSelectedWidget = controlView->GetWidgetID();
    if (theChange == kTrueStateMessage)
    //if (theSelectedWidget == kEXTCODGoButtonWidgetID
    switch(theSelectedWidget.Get())
             case kEXTCODGoButtonWidgetID:
      this->ViewOutput();
      break;
             case kEXTCODFindButtonWidgetID:
      this->SaveLog();
      break;
    // TODO: process this
    } while (kFalse);
    I do two actions "SaveLog" & "ViewOutput()" using two buttons. But i dont know how to execute an action when the ok button is clicked...

  • How to run others application in Oracle Forms on the web version?

    How to run others application in Oracle Forms on the web version?

    Pang,
    guess that you want to start client side programs from Forms on the Web. There is a sample on OTN (host bean) that allow you to acces sthe client and start executables.
    Frank

  • How to run a openssl command from a java program

    Hi All
    Please suggest on how to run a openssl command from a java program.
    I am using this
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("openssl pkcs8 -inform der -nocrypt test.der result.pem");
    This is suppose to take test.der as input and create result.pem.
    There are no errors but the file result.pem isnt created.
    Thanks in Advance

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

  • Can I run a windows software program taht is on a CD on my macbook pro after I install bootcamp and windows xp home?

    Can I run a windows software program that is on a CD on my macbook pro after I install bootcamp and windows xp home?

    genepaquin,
    the last MacBook Pros that supported installing Windows XP in a Boot Camp partition are the Mid 2010 models. If your MacBook Pro is newer than that, and you don’t have a newer version of Windows to install into a Boot Camp partition on your MacBook Pro, then you might consider an alternative such as running Windows with the help of programs such as VirtualBox or Parallels Desktop rather than through Boot Camp.

  • Can i create an exetutable (.exe) program with java???????

    I would like to learn how i can create an exetutable (.exe) program with java.
    Is there any additional package which i should download or buy it?
    Also i would like to write files into CD's direct from my application.
    Is there any library which i must download or buy?
    Thanks!

    check out the free open source GNU gcj native compiler for Java to see if it will do what you want.
    http://gcc.gnu.org/java/
    for writing data files you could use java.io.BufferedWriter. For sound files, look in the javax.sound package

  • Run a program from java code

    I want to run this program from my java code,
    In Linux(ubuntu) I write this command to open the program window
    $ paraFoam -case /home/saud/OpenFOAM/OpenFOAM-1.5/run/tutorials/icoFoam/cavity/In my java code I wrote it like this("/home/saud/OpenFOAM/OpenFOAM-1.5/bin/" is the path of the program):
    String command = "/home/saud/OpenFOAM/OpenFOAM-1.5/bin/paraFoam " +
              "-case /home/saud/OpenFOAM/OpenFOAM-1.5/run/tutorials/icoFoam/cavity/";
    final Process myProcess = Runtime.getRuntime().exec(command);
    BufferedReader buf = new BufferedReader(new InputStreamReader(
              myProcess.getInputStream()));
    String line;
    while ((line = buf.readLine()) != null) {
         System.out.print(String.format("%s\t\n", line));
    buf.close();
    int returnCode = myProcess.waitFor();
    System.out.println("Return code = " + returnCode); Return code = 0
    but the program is not opening
    Edited by: Saud.R on Apr 11, 2009 3:37 AM

    Welcome to the Sun forums.
    I am not sure of the answer to your question, but people who use Processes regularly, warn other users to ensure they are also doing something with the error stream of the process, otherwise it can hang as you describe.

  • How Can I execute a java program using java code?

    {color:#000000}Hello,
    i am in great trouble someone please help me. i want to execute java program through java code i have compiled the java class using Compiler API now i want to execute this Class file through java code please help me, thanks in advance
    {color}

    Thanks Manko.
    i think my question was not clear enough.. actually i want to run this class using some java code . like any IDE would do i am making a text editor for java, as my term project i have been able to complie the code usign compiler api and it genertaes the class file but now i want to run this class file "THROUGH JAVA CODE" instead of using Java command. I want to achive it programatically. do you have any idea about it.. thanks in advance

  • Setting Windows Envirnoment variables within Java code!!

    Hello All,
    How to setup Windows envirnoment variables within Java code dynamically.
    int customer = jList1.getSelectedIndex();
    System.out.println(customer);
    switch (customer)
    case 0:
    System.out.println("HOME1");
    break;
    case 1:
    System.out.println("HOME2");
    break;
    case 2:
    System.out.println("HOME3");
    break;
    case 3:
    System.out.println("HOME4");
    break;
    default:
    System.out.println("HOME5");
    break;
    }

    set windows %HOME% variableWhat is it?
    A system-wide resource? Something pertinent to the processes of a given user? Or does it apply only to your Java process?

Maybe you are looking for

  • HT201317 Photostream doesn't work in iPhoto

    I have turned on Photostream in System Preferences on my iMac, but it doesn't work. I have tried to enable it in iPhoto but it returns the message: "iPhoto was unable to connect to Photostream". I am running OS X 10.7.5. Any suggestions? There are no

  • Upgrading from 10.2 to 10.3

    I am trying to update from 10.2 to 10.3 and I need to update my firmwere how do i do this

  • Can't re-install Lion

    Hi, I had some problems with my macbook air 2008 so a apple support guy told me to re-install it. I made a bootable hard drive and follow the instructions. I reset my mac and the the Hdd didn't showed up, only the main osx system and the recovery hd.

  • LaunchPad Does Not Showing icons Of Few Apps

    Hi Guys I Got A Realy Bug Problem, Launchpad does not showing icons on some apps, but names - it does. its realy annoying, here is picture of the problem(maybe in file not so sure):

  • Disconnected source database model load

    Hello, I tried sqlserver7 to oracle 9.2 and my log is: ***** Operating System Information ******** name : Windows 2000 version : 5.0 ** The following plugins are installed: ** Microsoft SQLServer 7.0 Plugin, Release 9.2.0.1.3 Production ** Active Plu