How can I run external console program, printing output to JTextPane?

How can I run external console program, printing output to JTextPane?
I have a console app. written in C++ and I would like to run in it from java swing app. and I would like to see its output in a JTextPane.

I have used this article
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
to successfully pipe output from jboss batch files to a JTextPane.

Similar Messages

  • How can i run my java program with out java language

    Hai to every one ..Iam new to java language ...am using windows xp operating system , i did not installed java language in my system .. how can i run a java program with out installing java language... Which files is requied to run java program..?
    any one can help me??

    Hai to every one ..Iam new to java language ...am
    using windows xp operating system , i did not
    installed java language in my system .. how can i run
    a java program with out installing java language...
    you ... can ... not ... do ... this
    Which files is requied to run java program..?
    any one can help me??a JVM. Download it from sun's website.
    [url http://java.sun.com/javase/downloads/index.jsp]Download JavaSE here

  • How can i run my java program in background process?

    hi all,
    i am working on desktop monitoring so when i start my program on client machine that is visible to all but i want this program client not visible to all instead of this can be run in background process . so, nobody can see that.
    so, how i can do this ?
    pls pls help me
    thanks in advanced to helper
    regards
    maulik & ritesh

    this will run the java program in the background.It'll just use the Windows Java Console instead of the command-line console. It has nothing to do with running as a background process.
    Edit: though this might be exactly what the OP wants: not "background process" but "no DOS console".

  • How can I run a java program on Linux?

    I have JBuilder's IDE installed on my Linux partition and it works. However I don't know how to compile and test a program without it. Also I tried to install Limewire on Linux and although I've installed the Java SDK on the system. Once before I installed JBuilder and then JBuilder (I guess) installed it again. However it told me it couldn't find the Java Virtual Machine. Isn't this installed with the JDK? I am able to run programs through JBuilder so I can't see why I'd have a problem. Any answers to the above issues would be greatly appreciated.

    Go here and work out how to make a simple app to compile and run on the command line: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/unix.html#2b
    (You should find the JDK from a directory under the jbuilder directory so use that and not the /usr/local/jdk1.4 in the example.)
    Then find the classes or source code of your project and do the same thing to it.

  • How can I run a perl program from XPRESS?

    Hellos..
    Java it seems has no concept of file permissions and ownership.
    Our handbuilt IDM XML file output adapter create files OK but they seem to be owned and have default permissions of root the account that kicks off the App Server.
    We want these XML files our resource adapter (written in java) creates to be accessible by a noshell account so it can get them with scp.
    The easiest way I thought was to have a little perl script in the mix. Must I really exec() `chmod` and `chown` ?
    I notice there is the <script> </script> for javascript 'coding'... when do we get a <perl> </perl> interface for doing useful things?
    GF

    here there is an example about how a PL/SQL procedure can
    work with an external C program.
    http://download-east.oracle.com/docs/cd/A87860_01/doc/appdev.817/a76936/dbms_pi2.htm#1003384
    Apart from that you have Java Stored Procedures option
    to carry out your task.
    Java Stored Procedures Developer's Guide Contents / Search / Index / PDF
    http://download-east.oracle.com/docs/cd/B10501_01/java.920/a96659.pdf
    Joel P�rez

  • How can I run the C program which will interact with user

    hi, all
    I wanna run a C program whose function is that just show a line of characters, waiting for user input and finally show what user has entered. The C can run correctly in command window. But when I use Runtime class, it can not run correctly. My question is that how I can emulate that C program just by invoking Java method. The code I have written below, thank.
          String command = "cmd /c a.exe";  // a.exe is that C program
          String s;
          try {
             Process process = Runtime.getRuntime().exec(command);
             InputStream input = process.getInputStream();
             BufferedReader bufferedReader =
                new BufferedReader(new InputStreamReader(input));
             while((s = bufferedReader.readLine()) != null)
                  System.out.println(s);
          catch(IOException e) {
             System.err.println("IOException: " + e.getMessage());
          }

    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html#getOutputStream()

  • How can I run a custom program ASYNCHRONOUSLY when booting WinPE?

    I have a custom application that I want to have running during WinPE for my Litetouch deployments. I had this working in SCCM and now I want to get it working in MDT.
    I have the Netcheck.exe application in my Extras folder, it ends up on the root of my X: drive.
    Here is my unattend.xml file.
    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="windowsPE">
            <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
                <Display>
                    <ColorDepth>32</ColorDepth>
                    <HorizontalResolution>1024</HorizontalResolution>
                    <RefreshRate>60</RefreshRate>
                    <VerticalResolution>768</VerticalResolution>
                </Display>
    <RunAsynchronous>
    <RunAsynchronousCommand>
    <Order>1</Order>
    <Path>X:\NetCheck.exe</Path>
    <Description>Run the NetCheck app</Description>
    </RunAsynchronousCommand>
    <RunAsynchronousCommand>
    <Order>2</Order>
    <Path>wscript.exe X:\Deploy\Scripts\LiteTouch.wsf</Path>
    <Description>Lite Touch PE</Description>
    </RunAsynchronousCommand>
    </RunAsynchronous>
            </component>
        </settings>
        <cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    By default, the Litetouch.wsf file is launched synchronously, and so my Netcheck app won't run until the Litetouch wizard closes (this won't work for my needs). Also, synchronous commands are run before Asynchronous commands.  Therefore, I need to run
    both my custom Netcheck app and the Litetouch wizard Asynchronously.
    However, every time I use the unattend file that I pasted above, WinPE boots and then immediately reboots. If I am quick and hit F8 I get a command prompt, and then my Netcheck app and the Litetouch wizard both run (sweet!), but then when I close that cmd
    prompt, WinPE shuts down (lame).
    The wpeinit.log is shown below. Everything seems to look good, so what is wrong? How can I accomplish this?
    2014-09-09 14:23:02.588, Info      WPEINIT is processing the unattend file [X:\unattend.xml]
    2014-09-09 14:23:02.588, Info      Spent 141ms initializing removable media before unattend search
    2014-09-09 14:23:02.604, Info      ==== Initializing Display Settings ====
    2014-09-09 14:23:02.620, Info      Setting display resolution 1024x768x32@60: 0x00000000
    2014-09-09 14:23:02.620, Info      STATUS: SUCCESS (0x00000000)
    2014-09-09 14:23:02.620, Info      ==== Initializing Computer Name ====
    2014-09-09 14:23:02.620, Info      Generating a random computer name
    2014-09-09 14:23:02.620, Info      No computer name specified, generating a random name.
    2014-09-09 14:23:02.620, Info      Renaming computer to MININT-9KBBIFF.
    2014-09-09 14:23:02.620, Info      Waiting on the profiling mutex handle
    2014-09-09 14:23:02.620, Info      Acquired profiling mutex
    2014-09-09 14:23:02.620, Info      Service winmgmt disable: 0x00000000
    2014-09-09 14:23:02.620, Info      Service winmgmt stop: 0x00000000
    2014-09-09 14:23:02.620, Info      Service winmgmt enable: 0x00000000
    2014-09-09 14:23:02.620, Info      Released profiling mutex
    2014-09-09 14:23:02.620, Info      STATUS: SUCCESS (0x00000000)
    2014-09-09 14:23:02.620, Info      ==== Initializing Virtual Memory Paging File ====
    2014-09-09 14:23:02.620, Info      No WinPE page file setting specified
    2014-09-09 14:23:02.635, Info      STATUS: SUCCESS (0x00000001)
    2014-09-09 14:23:02.635, Info      ==== Initializing Optional Components ====
    2014-09-09 14:23:02.635, Info      WinPE optional component 'Microsoft-WinPE-HTA' is present
    2014-09-09 14:23:02.651, Info      WinPE optional component 'Microsoft-WinPE-MDAC' is present
    2014-09-09 14:23:02.651, Info      WinPE optional component 'Microsoft-WinPE-WMI' is present
    2014-09-09 14:23:02.667, Info      WinPE optional component 'Microsoft-WinPE-WSH' is present
    2014-09-09 14:23:02.682, Info      STATUS: SUCCESS (0x00000000)
    2014-09-09 14:23:02.682, Info      ==== Initializing Network Access and Applying Configuration ====
    2014-09-09 14:23:02.682, Info      No EnableNetwork unattend setting was specified; the default action for this context is to enable networking support.
    2014-09-09 14:23:02.682, Info      Global handle for profiling mutex is non-null
    2014-09-09 14:23:02.682, Info      Waiting on the profiling mutex handle
    2014-09-09 14:23:02.682, Info      Acquired profiling mutex
    2014-09-09 14:23:02.997, Info      Install MS_MSCLIENT: 0x0004a020
    2014-09-09 14:23:02.997, Info      Install MS_NETBIOS: 0x0004a020
    2014-09-09 14:23:03.138, Info      Install MS_SMB: 0x0004a020
    2014-09-09 14:23:03.326, Info      Install MS_TCPIP6: 0x0004a020
    2014-09-09 14:23:03.702, Info      Install MS_TCPIP: 0x0004a020
    2014-09-09 14:23:03.702, Info      Service dhcp start: 0x00000000
    2014-09-09 14:23:03.702, Info      Service lmhosts start: 0x00000000
    2014-09-09 14:23:03.827, Info      Service ikeext start: 0x00000000
    2014-09-09 14:23:03.921, Info      Service mpssvc start: 0x00000000
    2014-09-09 14:23:03.921, Info      Service mrxsmb10 start: 0x00000000
    2014-09-09 14:23:03.921, Info      Released profiling mutex
    2014-09-09 14:23:03.921, Info      Spent 1250ms installing network components
    2014-09-09 14:23:04.108, Info      Installing device root\kdnic X:\windows\INF\kdnic.inf succeeded
    2014-09-09 14:23:04.608, Info      Installing device vmbus\{f8615163-df3e-46c5-913f-f2d2f965ed0e} X:\windows\INF\wnetvsc.inf succeeded
    2014-09-09 14:23:04.670, Info      Spent 750ms installing network drivers
    2014-09-09 14:23:09.768, Info      QueryAdapterStatus: found operational adapter with DHCP address assigned.
    2014-09-09 14:23:09.768, Info      Spent 5062ms confirming network initialization; status 0x00000000
    2014-09-09 14:23:09.768, Info      STATUS: SUCCESS (0x00000000)
    2014-09-09 14:23:09.768, Info      ==== Applying Firewall Settings ====
    2014-09-09 14:23:09.768, Info      STATUS: SUCCESS (0x00000001)
    2014-09-09 14:23:09.768, Info      ==== Executing Synchronous User-Provided Commands ====
    2014-09-09 14:23:09.768, Info      STATUS: SUCCESS (0x00000001)
    2014-09-09 14:23:09.768, Info      ==== Executing Asynchronous User-Provided Commands ====
    2014-09-09 14:23:09.768, Info      Parsing RunAsynchronousCommand: 2 entries
    2014-09-09 14:23:09.768, Info        Command 0: 0x00000000
    2014-09-09 14:23:09.768, Info      Successfully executed command 'X:\NetCheck.exe'
    2014-09-09 14:23:09.768, Info        Command 1: 0x00000000
    2014-09-09 14:23:09.784, Info      Successfully executed command 'wscript.exe X:\Deploy\Scripts\LiteTouch.wsf'
    2014-09-09 14:23:09.784, Info      STATUS: SUCCESS (0x00000000)
    2014-09-09 14:23:09.784, Info      ==== Applying Shutdown Settings ====
    2014-09-09 14:23:09.784, Info      No shutdown setting was specified
    2014-09-09 14:23:09.784, Info      STATUS: SUCCESS (0x00000001)

    Here is how i ended up solving my problem.
    Change the unattend file to look like this:
    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
    <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
    <Display>
    <ColorDepth>32</ColorDepth>
    <HorizontalResolution>1024</HorizontalResolution>
    <RefreshRate>60</RefreshRate>
    <VerticalResolution>768</VerticalResolution>
    </Display>
    <RunSynchronous>
    <RunSynchronousCommand>
    <Order>1</Order>
    <Path>wscript.exe X:\Deploy.vbs</Path>
    <Description>Run the .vbs file that kicks off Netcheck and the Litetouch wizard</Description>
    </RunSynchronousCommand>
    </RunSynchronous>
    </component>
    </settings>
    <cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    Here is the Deploy.vbs:
    Set objShell = Wscript.CreateObject("Wscript.shell")
    objShell.Run "X:\Netcheck.exe", 0, false
    objShell.Run "wscript.exe X:\Deploy\Scripts\LiteTouch.wsf", 0, true

  • How can i run external application without specifying the full path?

    for example, ms word executable file is winword.exe, but in java i am using the following command:
    Runtime.getRuntime().exec("\"C:\\Program Files\\Microsoft Office\\Office10\\winword.exe\");
    the thing is, i dont know where ms word is installed on every machine, so rather than making an assumption, do you know how i can run ms word without specifying the full path?
    thanks

    1) You could ask the user to tell you where it's at (and remember for next time)
    2) You could do a file search for it (and remember it for next time)

  • How can I run this java program? Please help.

    I have jmf installed, sunone running , the file may be in the wrong directory.
    It is in some directory nowhere near the java lang dir.
    When I try to compile or build i cant. I'm off on a basic thing.
    here is the code.
    import     javax.sound.midi.InvalidMidiDataException;
    import     javax.sound.midi.MidiDevice;
    import     javax.sound.midi.MidiSystem;
    import     javax.sound.midi.MidiUnavailableException;
    import     javax.sound.midi.Receiver;
    import     javax.sound.midi.MidiMessage;
    import     javax.sound.midi.ShortMessage;
    import     javax.sound.midi.SysexMessage;
    public class MidiNote
         /**     Flag for debugging messages.
              If true, some messages are dumped to the console
              during operation.
         private static boolean          DEBUG = false;
         public static void main(String[] args)
              try {
                   // TODO: make settable via command line
                   int     nChannel = 0;
                   int     nKey = 0;     // MIDI key number
                   int     nVelocity = 0;
                   *     Time between note on and note off event in
                   *     milliseconds. Note that on most systems, the
                   *     best resolution you can expect are 10 ms.
                   int     nDuration = 0;
                   int     nArgumentIndexOffset = 0;
                   String     strDeviceName = null;
                   if (args.length == 4)
                        strDeviceName = args[0];
                        nArgumentIndexOffset = 1;
                   else if (args.length == 3)
                        nArgumentIndexOffset = 0;
                   else
                        printUsageAndExit();
                   nKey = Integer.parseInt(args[0 + nArgumentIndexOffset]);
                   nKey = Math.min(127, Math.max(0, nKey));
                   nVelocity = Integer.parseInt(args[1 + nArgumentIndexOffset]);
                   nVelocity = Math.min(127, Math.max(0, nVelocity));
                   nDuration = Integer.parseInt(args[2 + nArgumentIndexOffset]);
                   nDuration = Math.max(0, nDuration);
                   MidiDevice     outputDevice = null;
                   Receiver     receiver = null;
                   if (strDeviceName != null)
                        MidiDevice.Info     info = getMidiDeviceInfo(strDeviceName, true);
                        if (info == null)
                             out("no device info found for name " + strDeviceName);
                             System.exit(1);
                        try
                             outputDevice = MidiSystem.getMidiDevice(info);
                             outputDevice.open();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                        if (outputDevice == null)
                             out("wasn't able to retrieve MidiDevice");
                             System.exit(1);
                        try
                             receiver = outputDevice.getReceiver();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                   else
                        /*     We retrieve a Receiver for the default
                             MidiDevice.
                        try
                             receiver = MidiSystem.getReceiver();
                        catch (MidiUnavailableException e)
                             if (DEBUG) { out(e); }
                   if (receiver == null)
                        out("wasn't able to retrieve Receiver");
                        System.exit(1);
                   /*     Here, we prepare the MIDI messages to send.
                        Obviously, one is for turning the key on and
                        one for turning it off.
                   MidiMessage     onMessage = null;
                   MidiMessage     offMessage = null;
                   try
                        onMessage = new ShortMessage();
                        offMessage = new ShortMessage();
                        ((ShortMessage) onMessage).setMessage(ShortMessage.NOTE_ON, nChannel, nKey, nVelocity);
                        ((ShortMessage) offMessage).setMessage(ShortMessage.NOTE_OFF, nChannel, nKey);
                        /* test for SysEx messages */
                        //byte[] data = { (byte) 0xF0, (byte) 0xF7, (byte) 0x99, 0x40, 0x7F, 0x40, 0x00 };
                        //onMessage = new SysexMessage();
                        //offMessage = new SysexMessage();
                        //onMessage.setMessage(data, data.length);
                        //offMessage = (SysexMessage) onMessage.clone();
                   catch (InvalidMidiDataException e)
                        if (DEBUG) { out(e); }
                   *     Turn the note on
                   receiver.send(onMessage, -1);
                   *     Wait for the specified amount of time
                   *     (the duration of the note).
                   try
                        Thread.sleep(nDuration);
                   catch (InterruptedException e)
                        if (DEBUG) { out(e); }
                   *     Turn the note off.
                   receiver.send(offMessage, -1);
                   *     Clean up.
                   receiver.close();
                   if (outputDevice != null)
                        outputDevice.close();
              } catch (Throwable t) {
                   out(t);
              System.exit(0);
         private static void printUsageAndExit()
              out("MidiNote: usage:");
              out(" java MidiNote [<device name>] <note number> <velocity> <duration>");
              out(" <device name>\toutput to named device");
              out(" -D\tenables debugging output");
              System.exit(1);
         private static void listDevicesAndExit(boolean forInput, boolean forOutput) {
              if (forInput && !forOutput) {
                   out("Available MIDI IN Devices:");
              else if (!forInput && forOutput) {
                   out("Available MIDI OUT Devices:");
              } else {
                   out("Available MIDI Devices:");
              MidiDevice.Info[]     aInfos = MidiSystem.getMidiDeviceInfo();
              for (int i = 0; i < aInfos.length; i++) {
                   try {
                        MidiDevice     device = MidiSystem.getMidiDevice(aInfos);
                        boolean          bAllowsInput = (device.getMaxTransmitters() != 0);
                        boolean          bAllowsOutput = (device.getMaxReceivers() != 0);
                        if ((bAllowsInput && forInput) || (bAllowsOutput && forOutput)) {
                             out(""+i+" "
                                  +(bAllowsInput?"IN ":" ")
                                  +(bAllowsOutput?"OUT ":" ")
                                  +aInfos[i].getName()+", "
                                  +aInfos[i].getVendor()+", "
                                  +aInfos[i].getVersion()+", "
                                  +aInfos[i].getDescription());
                   catch (MidiUnavailableException e) {
                        // device is obviously not available...
              if (aInfos.length == 0) {
                   out("[No devices available]");
              System.exit(0);
    e
         *     This method tries to return a MidiDevice.Info whose name
         *     matches the passed name. If no matching MidiDevice.Info is
         *     found, null is returned.
         *     If forOutput is true, then only output devices are searched,
         *     otherwise only input devices.
         private static MidiDevice.Info getMidiDeviceInfo(String strDeviceName, boolean forOutput) {
              MidiDevice.Info[]     aInfos = MidiSystem.getMidiDeviceInfo();
              for (int i = 0; i < aInfos.length; i++) {
                   if (aInfos[i].getName().equals(strDeviceName)) {
                        try {
                             MidiDevice device = MidiSystem.getMidiDevice(aInfos[i]);
                             boolean     bAllowsInput = (device.getMaxTransmitters() != 0);
                             boolean     bAllowsOutput = (device.getMaxReceivers() != 0);
                             if ((bAllowsOutput && forOutput) || (bAllowsInput && !forOutput)) {
                                  return aInfos[i];
                        } catch (MidiUnavailableException mue) {}
              return null;
         private static void out(String strMessage)
              System.out.println(strMessage);
         private static void out(Throwable t)
              t.printStackTrace();

    Please post your code using code tags.
    When I try to compile or build i cant.What is your question? Exactly what error message do you get?

  • Can we run external mail program from JSP / Servlet deployed on tomcat

    Hi folks,
    Had a tough time getting JavaMail API to work, finally when things seem to be working
    there were some issues with the vendor's server, so finally gave up the idea.
    On the server Apache and Tomcat are integrated via mod_jk and currently I redirect to a php page
    which acts as a helper to send mail, however for the given business needs and server's limitations
    there are potential security holes.
    So I was wondering if I could directly execute the linux sendmail program from JSP/Servlet
    as we would in a standalone java program or do we need special settings on Tomcat to execute external
    programs.
    Please let me know your views / ideas / comments on this
    Thanks in advance
    Abishek

    Hi
    It's not designed for you to be able to do this, it needs to run through 10gAS or 11gWeblogic.
    Tony

  • How can i run my vi writing its output in Excel in a real time?

    My vi is open and excel is open while my vi is inserting the data in excel.
    Thank You
    (can i have a simple example?)

    Are you running LabVIEW or LabVIEW Real-Time?
    To write data from LabVIEW to Excel, you can either use Write to Spreadsheet VI from the File I/O palette, or use activeX technology. Additionally, if you have the Report Generation Toolkit you could create Excel reports with LabVIEW.
    Here are some links that should help you.
    Writing Rows to Excel 97 and Excel 2000 Using ActiveX
    Creating a Report in Microsoft Excel Using the LabVIEW Report Generation Toolkit: Introduct
    ion
    Zvezdana S.

  • How can i run applets in kawa?

    how can i run compiled applet programs in KAWA
    help me

    If you always have the external display connected, you can configure the OS to consider it as the default or main display. Once everything is connected and set to your liking (resolution, color depth, etc.), "bless" the external display by clicking & dragging the menubar from the Mac's internal display onto the external. This only works if you are not using video mirroring.
    Once this is done, applications will open by default on the external and now "main" display and you can configure them to go fullscreen or whatever.

  • How can i run the java bean sample program download from OTN

    hello to all
    i have a p[roblem. i have downloaded the sample progam from oracle web site which is a java code that connect with the oracle and shows a form. how can i run the from.
    can any body help me pleaSEEE
    thanks
    kamran ahmed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi Darryl.Burke
    So your telling, we cannot run our Java Program when system shutdowns...In my application, when user has schedule for next days and he shutdown his PC. On the next day when System Started i should able to get back my schedule on the Specified time(I'm TimerTask class in Java)... How can i achieve this using Java? can u tell me clearly..

  • How do i run a java program an another directory?

    How do I run a java program that's in a different directory?
    I have been doing this in the command line:
    java "C:\Document and Settings\freeOn\Desktop\Java\Test\test"
    and I get
    Exception in thread "main" java.lang.NoClassDefFoundError:
    C:\Document and Settings\freeOn\Desktop\Java\Test\test
    I just thought there might be a quick way to do this and not
    have to cd to the following dir evertime i want to run an app in
    console.
    The test.java file is this:
    import java.io.*;
    public class test {
        public static void main(String args[]) {
          System.out.println("Testing.....");

    Ok I looked in the java help and found the classpath, this makes it alittle easier.
    java -cp C:\DOCUME~1\freeOn\Desktop\Java\Test\ test
    At least i can run this in the run dialog which makes it easier thanks for you help kota balaji

  • How can I run Runtime.exec command in Java To invoke several other javas?

    Dear Friends:
    I met a problem when I want to use a Java program to run other java processes by Runtime.exec command,
    How can I run Runtime.exec command in Java To invoke several other java processes??
    see code below,
    I want to use HelloHappyCall to call both HappyHoliday.java and HellowWorld.java,
    [1]. main program,
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloHappyCall
         public static void main(String[] args){
              try
                   Runtime.getRuntime().exec("java  -version");
                   Runtime.getRuntime().exec("cmd /c java  HelloWorld "); // here start will create a new process..
                   System.out.println("Never mind abt the bach file execution...");
              catch(Exception ex)
                   System.out.println("Exception occured: " + ex);
    } [2]. sub 1 program
    package abc;
    import java.util.*;
    import java.io.*;
    class HelloWorld
         public static void main(String[] args){
         System.out.println("Hellow World");
    } [3]. Sub 2 program:
    package abc;
    import java.util.*;
    import java.io.*;
    class HappyHoliday
         public static void main(String[] args){
         System.out.println("Happy Holiday!!");
    } When I run, I got following:
    Never mind abt the bach file execution...
    I cannot see both Java version and Hellow World print, what is wrong??
    I use eclipse3.2
    Thanks a lot..

    sunnymanman wrote:
    Thanks,
    But How can I see both programs printout
    "Happy Holiday"
    and
    "Hello World"
    ??First of all, you're not even calling the Happy Holiday one. If you want it to do something, you have to invoke it.
    And by the way, in your comments, you mention that in one case, a new process is created. Actually, new processes are created each time you call Runtime.exec.
    Anyway, if you want the output from the processes, you read it using getInputStream from the Process class. In fact, you really should read that stream anyway (read that URL I sent you to find out why).
    If you want to print that output to the screen, then do so as you'd print anything to the screen.
    in notepad HelloWorld.java, I can see it is opened,
    but in Java, not.I have no idea what you're saying here. It's not relevant whether a source code file is opened in Notepad, when running a program.

Maybe you are looking for

  • I have photos on my phone and need to e-mail a bunch of them, how do I find them in photo stream and how do I mail them

    I have photos on my phone and need to e-mail a bunch of them, I can't find them on my computer where did they go?

  • 20" display not working properly

    The display only works with a 90w brick instead of the 65w brick it came with. It was intermittent for a while and then it just gave me the light code of short, long, short, which says: "Make sure you are using the correct power adapter with the disp

  • External display freezing & phone restarting

    I've had an 8200 for just over a month now, and exchanged my original for a new one last week.  The original was powering off randomly and not turning back on without having the battery removed and replaced. This one (in use for 4 days now) has begun

  • ITunes Wifi and iPhone 6

    Here I am with NEW OX Yosemite NEW iPhone 6 plus and the SAME issue of the phone and iTunes not connecting via WIFI.  WHY does this issue persist?  What can be don about this????  If I have my NEW phone NEXT to my computer and iTunes is running it SH

  • Different ways to do a presentation?

    Hello, i'm no presentation expert, thus I often turn to Microsoft Powerpoint for my presentation purposes. However, I've worked with some people who present off of PDFs, which they prefer as it makes it very easy for them to give the presentation to