How can I run a dos command from java on windows 98, 95?

The usage of cmd.exe in the java program to run a dos command on windows 98. 95 doesn't work as the equivalent command is command.exe
But using the command.exe in the java program makes my program to hang.

hi,
As u mentioned, u cannot use the cmd.exe in win9x environment as cmd.exe is specific to windows NT, you can use the command.exe without any hitches.
for eg
java.lang.Runtime.getRuntime().exec("start command /K a.bat"); should run the batch file a.bat..
if the problem persists, try posting the snippet of code that you are using.
cheerz
ynkrish

Similar Messages

  • 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.

  • Executing a dos command from java in windows nt

    i need to execute the
    " net send"
    command from the command line in windows nt, from within my java program... is there any way that i can execute cmommands in the dos command shell? or rather, does anybody know a way i can send a message ( in windows ) from java, from one computer to another over the lan?? I cannot have a java programming running on all the other computers, so i cannot make my program serve, it must just send the messges using a lan command....
    (the net send command just sends a message in the form of a pop up box on the receiver's screeen)
    thanks a bunch guys!!!
    Thanks a bunch guys!!!!

    you can do that with exec() in Runtime.
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(command here);but before you do that you need to read this:
    http://www.javaworld.com/jw-12-2000/jw-1229-traps.html
    hth
    partha

  • How can i run a linux command in java app?

    i created a cell script to run the compile process of my C++ simulator and want to control it thru java application, i tried the following but it doesn't work.
    the command in linux should be. under the path /home/workspace/SIM/ run: . / zs_compile
    and i use runtime to do this
    String path="home/workspace/SIM/ . /zs_compile";
    try {Runtime.getRuntime().exec(path);}
    catch( IOException e) {
    e.printStackTrace() ;
    Error report is java.io.IOException: java.io.IOException: home/workspace/SIM/ . /zs_compile : not found
    who can help me to find the reason, thanks a lot!!!!!

    the reason is that the command you're truing to execute can't be found. se this article for other traps relatd to runtime.exec:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    the command in linux should be. under the path /home/workspace/SIM/ run: . / zs_compilecould yu elaborate a bit? "should be . under the path" -- do you mean it should be sourced from that path? Sourcing a script file makes no sense from a Java program.

  • How to run a DOS command from an Oracle form.

    How can I run a DOS command from an Oracle form (i.e. open the calculator located at c:\windows\system32\calc.exe)?

    first of all get the environment variable for the c:\windows\system32 direcotry for any of the windows
    you can use get variable from the ora env package
    now cancat the system32 variable with the calc.exe string
    now pass the string with host command as parameters
    this process will work for all type of windows.

  • How can I run a BW Function from EXCEL-IN-PLACE (BPS)??? Please give any ex

    How can I run a BW Function from EXCEL-IN-PLACE (BPS)using VBA??? Please give any example.
    I would like to run my function module ZMY from EXCEL-IN-PLACE using VBA and get a result.

    if you are using excel in place in the web application environment I doubt you can, you've never really had any macro functionalty there.
    If you are in the gui environemnt (Planning folders) it will depend on how you want to invoke the module...

  • Dos command from java

    hi all
    how do i run dos commands from java??????????

    Using Runtime#exec().
    Also see http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html

  • DOS command from java applet

    Hi, I need to perform a DOS command from Java (using WFC if needed)...
    I have no idea, so please help!
    Thank you.

    OH OH OH WAIT! It is an Applet! i think there will be some security issues here! Sure enough you can't execute commands on the system from an applet unless you make some changes on the java.policy files on the client machine (that means, if your applet is in a web page, every machine which view your page).

  • Can I execute MySql's command from java application?

    Can I execute MySql's command from java application? And how?
    For example :
    load data local infile 'D:\\myData.txt'
    into table myTable
    fields terminated by ';'
    lines terminated by '\n';

    1. get the jdbc driver for mysql from the mysql site at: http://dev.mysql.com/downloads/connector/j/5.0.html
    2. follow the installation instructiions... which you'll also find in your mysql manual...
    Happy travels. Keith.

  • Unix and dos commands from Java

    How can I issue a unix command from a java program eg: setenv
    help would be appreciated

    setenv is a C shell builtin command. And it wouldn't make any sense to execute setenv from Java anyway, because the environment variable changes would only apply to that shell and possibly (if the variable is exported) to subprocesses.
    But look at the java.lang.Runtime.exec() method and the Process class.
    (http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html)
    Be careful of input and output to the commands. If the command produces output and you don't read it from the getOutputStream(), your command will hang forever when the OS stdio buffer fills up. This can cause terrible random hangs. Search the forums for more on how to handle input and output. You'll probably need multiple threads to read/write the different streams. (stderr, stdout, stdin)

  • How can i get the source code from java concurrent program in R12

    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    Zulqarnain

    user570667 wrote:
    Hi 2 all,
    How can i get the source code from java concurrent program in R12? like , "AP Turnover Report" is java concurrent program, i need to get its source code to know its logic. how can i get its source code not the XML template?
    Regards,
    ZulqarnainDid you see old threads for similar topic/discussion? -- https://forums.oracle.com/forums/search.jspa?threadID=&q=Java+AND+Concurrent+AND+Source+AND+Code&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • How can i call forpro prg file from java

    Hai friends,
    I have a doubt,clear it.
    how can i call forpro prg file from java file
    by,
    N.Vijay

    Thanks to your reply,
    I have some print statements in my foxpro program file.
    Then i like to invoke that foxpro file from my java file
    This want i want..,
    by,
    N.Vijay

  • How can I run a gui app from an su shell?

    Hello,
    I login to my mac as a non-admin account.  I then open a terminal and su to my admin account for anything requiring it.  I am trying to run a gui app from the terminal window, but get this error, and the app does not open:
    $ /usr/local/bin/wireshark
    2011-08-14 06:54:29.327 defaults[18406:903]
    The domain/default pair of (kCFPreferencesAnyApplication, AppleAquaColorVariant) does not exist
    2011-08-14 06:54:29.346 defaults[18407:903]
    The domain/default pair of (kCFPreferencesAnyApplication, AppleHighlightColor) does not exist
    ./sync_osx_look.sh: line 40: gtkrc: Permission denied
    (process:18396): Gdk-WARNING **: locale not supported by C library
    (wireshark-bin:18396): Gtk-WARNING **: Locale not supported by C library.
              Using the fallback 'C' locale.
    (wireshark-bin:18396): Gtk-WARNING **: cannot open display:
    I know I can "switch user" but this is cumbersome as it requires typing a password each time, and I need to have applications side-by-side for easy access and testing.  Any thoughts?
    Thanks.

    I use LaunchAsRoot to run GUI apps as the root user, while logged in to my admin account.
    Another way is to use Applescript.  Here's what I do to run Console as root:
    do shell script "/Applications/Utilities/Console.app/Contents/MacOS/Console > /dev/null 2>&1 &" with administrator privileges

  • Run dos command from java

    May I ask how I should write if I want to execute a dos command in java? The command is :
    "C:\Program Files\Real\realproducer\rmeditor -i abc.rm -d abc.txt". Should I use array?
    Thanks!

    why an array ?
    String command = "C:\\Program Files\\Real\\realproducer\\rmeditor -i abc.rm -d abc.txt";
    Process p = Runtime.getRuntime().exec( command );what about the seach function on the left side ? ;-)
    tobias

  • Invoking dos commands from java

    hi all,
    I just want to invoke dos prompt from java.I know it can be done using "Runtime.getRuntime()" command.But when i try to create a directory inside another directory,how can i specify the path of the destination directory.i googled as well as tried different things.But i failed to make it up.Please help me solve this problem.
    thanks in advance
    Regards

    Hai,
    Thanks for your respond.
    If I give "cmd" command only, I am getting dos command window, but I didn't get the prompt like
    c: or d:
    How can I do it?
    Expecting more helps
    Joseph

Maybe you are looking for

  • How do I search for a song with the name I typed on my iPhone?

    I run into this a lot and it is extremely frustrating. I want to find a song like "Menuetti", but the search results end up with hundreds of variations of "Menuetto". Even though I know Menuetti is there somewhere, I can't find the song I am looking

  • How to get same vales in a array continously

    Hii    i  have attached one vi in that repeated value in a array have to arrange continously..how to do it ? Attachments: Array sorting.vi ‏7 KB

  • Why java file name and class name are equal

    could u explain why java file name and class name are equal in java

  • Master password incorrect sometimes..?

    After not using my desktop for a week, I came home and woke up my computer and the "required password" that I requested to wake up my computer came up. I entered in THE CORRECT password, many many times, and it said incorrect. I shut down the mac, st

  • Can't connect to my home WiFi network

    I'm using a linksys router and using WEP security. The iphone can see my network, but when I enter the password it tells me I can't connect. I can't seem to make the phone forget the network so that I can start over. Any help would be appreciated