Pass commands to running program using command prompt

I have a program written in core java.
This program do not contain any gui. As this program is to start using shell script , there will not be a command prompt open. Now , after program is started , i need to give the commands like \q for exit, \w to open some action etc .....
How can i pass these commands to that already running program.
I expect in the following way-
Open a command prompt
Select a specific path.
when i type \w and enter then the running program should do some action.
Can any one help me?
Program will be running on Linux.

Stop cross-posting:
http://forum.java.sun.com/thread.jsp?thread=512664&forum=31&message=2438136
http://forum.java.sun.com/thread.jsp?thread=512663&forum=54&message=2438134
http://forum.java.sun.com/thread.jsp?thread=512267&forum=422&message=2435704
MOD

Similar Messages

  • Cant See RTF Files in JAR but can when running program from command prompt

    posted August 16, 2005 08:26 AM
    Hi ALL:
    I have a Java Swing APP. It has Menus which displays information through File I/O in a JEditorPane.
    When I run my program from Command Prompt using "java myApp" it shows these RTF Files as it is.
    However when I run them after converting Directory into a Executable JAR FILE, it fails. I get a blank JEditorPane. My RTF files are in the CORRECT PATH, just dont get displayed. Rest of the APP works fine.
    Chetan
    any suggetsions

    posted August 16, 2005 08:26 AM
    Hi ALL:
    I have a Java Swing APP. It has Menus which displays information through File I/O in a JEditorPane.
    When I run my program from Command Prompt using "java myApp" it shows these RTF Files as it is.
    However when I run them after converting Directory into a Executable JAR FILE, it fails. I get a blank JEditorPane. My RTF files are in the CORRECT PATH, just dont get displayed. Rest of the APP works fine.
    Chetan
    any suggetsions

  • Run report using command utility

    Hi All,
    I am working on OBIEE 11.1.1.6.0.
    can it is possible, Using command utility, we can run obiee report, and it's output should be any format other than text.
    and also this report schedule on hr basis, without using delivers.
    if this possible, then please suggest me how to achieve.
    Thanks in advance,
    Prashant

    Hi Veera,
    I ran the report using nqcmd and to achive the desired result I had also specified the path by giving -0, which had also generated the pdf file for the same but the problem is when I'm opening the pdf file it throws an error saying "could not open 'quar3.pdf' because it is either not a supported file type or because the file has been damaged". Below is what I had passed in cmd.
    D:\MI2\Oracle_BI1\bifoundation\server\bin>nqcmd -d coreapplication_OH1426052389
    -u weblogic -p weblogic_1 -s C:\quar3.sql -o C:\quar3.pdf
    I tried creating .xls, .doc which gets generated but it is not in a tabular format.
    Please help....
    Thanks,
    KD

  • Passing arguments into main program using eclipse

    If I want to pass a file into my Main program using "file redirection" I would do the following when running my program from the command prompt:
    C:\ MainProgram < inputfile.txt
    How do I do this using Eclipse SDK(WinXP)? I have investigated the options for passing in "Program Arguments" and still can't figure it out. Can anyone please help? What do I type in the Program Arguments text box?
    Thank you,
    Mark

    Well, input redirection is a shell thing, so Eclipse may not support it like that. (Maybe it does, somehow, but if it does it's just aping shell behavior for convenience.)
    What I'd suggest, is to create an option to your program to read a specified file. Maybe something like
    MainProgram -input intputfile.txt
    Then give that as an argument in Eclipse.
    If this is for testing purposes, another option is to create a test class, and hardcode the filename in there.

  • Cant run program using modules in Netbeans

    Hi all,
    I wrote a program using netbeans modules and I can't run it,
    Does anyone knows why?
    I even tried to run it using CLI commands by moving to the directory where the jar file located and write the command:
    java -jar <file package> but I got the following error :
    Execption in thread "main" java.lang.NoClassDeFoundError: /org/jdesktop/layout/GroupLayoutGroup.
    Can someone please help me with this issue?

    no clue???????????

  • Checking for running programs using a abap program

    Is there a way in ABAP to detect from within a program that another process is running the same program? Meaning if PROG1 is running, could PROG1 check to see if another process is running program PROG1?

    Use the locking concept.   You can either create your own, or a popular one to use is ESINDX, passing parameters: relid 'ZZ', SRTFD program name, and SRTF2 = 0. 
    The logic is:
    Attempt to get lock (FM ENQUEUE_ESINDX, perhaps).
    If lock got -> run program
    If lock not got -> quit.
    You have to put this logic at the start of your program.
    matt

  • Error while trying to run program using java.exe

    First of all I'd like to apoligize if this thread already exists here somewhere.. I've spent the last hours Googling and searching the forums for an answer, but haven't found one, so I posted a topic..
    The problem is the following:
    I'm using Netbeans 5.5 with JDK1.6.0. When I build/run a Java application in this IDE, I get no errors whatsoever..
    But, when I try to run it from the prompt, using following code (I copied the .class file into the same directory as the .java file)
    java -classpath . main.javaI get the following errors:
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Sour
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Metho
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Sourc
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)I'm quite sure that the problem is something I'm simply missing, since Netbeans runs everything without troubles..
    Anyone an idea how I could solve this problem? (Trust me, I checked the net, lots of people with this prob, but no decent solutions given)
    Thanks in advance (and once again sorry if this thread already existed).
    Greetings,
    Tribio

    Oh, forgot the first error line indeed, thanks for pointing that out.
    D:\Tribio\JPF\src\jpf>java -cp . main
    Exception in thread "main" java.lan.NoClassDefFoundError: main (wrong name: jpf/Main)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Sour
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Metho
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Sourc
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)And concerning the package question. In the code of main.java I define the package jpf as follows:
    package jpf;Hateful problem, and I so wanna use the prompt java once in a while instead of having to rely on NetBeans..
    And you're not at all looking at it too simple, any input on the matter is appreciated.. :)

  • Running program via command-line

    I've using NetBeans IDE 5.5 and to run my projects, I simply click the "Run" button and everything goes fine. When I build the project, it says this:init:
    deps-jar:
    compile:
    To run this application from the command line without Ant, try:
    java -jar "/home/tristan/Java Programs/CalendarProgram/dist/CalendarProgram.jar"
    jar:
    BUILD SUCCESSFUL (total time: 1 second)I try that and I get:[tristan@tristan ~]$ java -jar "/home/tristan/Java Programs/CalendarProgram/dist /CalendarProgram.jar"
    Exception in thread "main" java.lang.UnsupportedClassVersionError: UserInterface  (Unsupported major.minor version 50.0)
            at java.lang.ClassLoader.defineClass0(Native Method)
            at java.lang.ClassLoader.defineClass(Unknown Source)
            at java.security.SecureClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$100(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)This happens on both my Fedora Core 5 and Windows XP machines. Maybe I'm just oblivious to the problem, but if it's giving me that argument to run, why won't it work but works when I click "Run" in NetBeans?

    Alriight. Well, when I type in java -version. It says I have 1.4.2 and NetBeans uses 1.6. I have no idea where 1.4.2 is installed (Linux), but since I'm compiling it with 1.6, does that mean no one else can run the program unless they have 1.6 on their machine?

  • Exec a "MV" (move) Linux command from ABAP program using wildcard "*"

    Hi,
    I have a problem by using FM "SXPG_COMMAND_EXECUTE", SM49 while i try to move the whole content of a SAP folder into another.
    Foders are on the same file system:
    source: /tmp/
    dest:   /usr/sap/tmp
    I made a command in SM69 named ZMOVE:
    I put OS: Linux (is case sensitive)
            command: "mv"
            parameters: /tmp/* /usr/sap/tmp
    hence the final sentence should be "mv /tmp/* /usr/sap/tmp". I did it directly by using program "rsbdcos0" and works fine.
    Now if I try to execute the command ZMOVE from SM49 or using the function module it gives the same error
    *mv: cannot stat  /tmp/ ': No such file or directory**
    I made several tries by changing the parameter section (also using a script on the same directory).
    The permissions are ok, so the only problem seems to be the wildcard (*) character.
    Any suggestions?
    Thanks in advance
    Fabrizio

    Problem solved.
    Forget function modules, SM69 etc. there's an ABAP command in order to perform a SO command.
    Here an example:
    data: lf_file like rlgrap-filename,
          lf_idx(3) type n,
          cmd(254),
          result(255) occurs 100 with header line.
    cmd = 'mv /dir_source/* /dir_dest'.
      call 'SYSTEM' id 'COMMAND' field cmd
                    id 'TAB'     field result-sys.

  • Problems running program using Runtime.exec()

    Hello everyone. I have a quick problem that perhaps someone can help me with... I'm trying to write a frontend for a command line program. I've found plenty of examples for using exec() to launch this program but I can't quite get the effect that I desire. The program itself launches it's own window (using a graphics library called SDL) but the user interacts with the program through the command prompt.
    The problem that I'm having is that my InputStream thread does not seem to execute until I close the SDL window. I've tried about 10 different combinations of threading this application but nothing seems to work.
    Below I've attached some sample code that I found here on the Sun site... The code does as I described before, the InputStream does not display any text until I close the SDL window.
    Can anyone help out?
    import java.io.*;
    // class StreamGobbler omitted for brevity
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    OutputStream os;
    StreamGobbler(InputStream is, String type)
    this(is, type, null);
    StreamGobbler(InputStream is, String type, OutputStream redirect)
    this.is = is;
    this.type = type;
    this.os = redirect;
    public void run()
    try
    PrintWriter pw = null;
    if (os != null)
    pw = new PrintWriter(os);
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    if (pw != null)
    pw.println(line);
    System.out.println(type + ">" + line);
    if (pw != null)
    pw.flush();
    } catch (IOException ioe)
    ioe.printStackTrace();
    public class TestExec
    public static void main(String args[])
    if (args.length < 1)
    System.out.println("USAGE: java TestExec \"cmd\"");
    System.exit(1);
    try
    String cmd = args[0];
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERR");
    // any output?
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();

    I'm pretty sure, because if you run the application without any parameters you don't get the SDL window, you just get a list of possible command line switches, that part works fine... It just seems that when the SDL window is open, the thread won't grab and display the individual lines until that window is closed, which will not work for my purposes...

  • Go Online on specific network using command line

    i have a remote troubleshooting software that i wrote myself i have added to it the list of all my clients which can have one of the below:public ipsteamviewer accountslogmein hamachiof course, i'm a paid hamachi client, and i have the latest hamachi version installed whenever i want to troubleshoot any client, i just right click on their name, and select remote desktop.. and the my software will automatically connect to the client using the required authentication/application. when the client has hamachi,his network has to be online, for me to be able to access his ip. so what i'm currently doing is: open hamachi, scroll to my client's network, right click, go online, and then back to my software and troubleshoot! (this is a bit time consuming compared to the other solutions) is there any way, i can go online on a specific network in my local hamachi installation? it would be really a great feature, if we can use a command line script, or use command line arguments to launch special events (locally)example:hamachi.exe /online:mynetworkidhamachi.exe /offline:mynetworkid i appreciate any feedback on this, regards,Dan

    Yes, It would be very interesting to have such a feature.E.g., I need to programmatically request Hamachi to GoOnline, because it often goes offline in some circumstances (after computer wakes from sleep mode for example).

  • How to use addKeyListener in a program running using command prompt

    Does anyone have any idea how to add the addKeyListener to a program running using command prompt.
    Let me explain how the program run.
    The program is start and accept call from other program. But from time to time, I need to issue some command by pressing the keyboard, let say, ESC is closed the program, F1 is showing the stated. F2.... (This is all need to run in the command prompt windows)
    My problem is this program does not have any gui interface, so how can it be added?
    i do it this way
    public void key(){          
    addKeyListener(this);
    But it have compile error.
    mainServerImpl.java:87: cannot resolve symbol
    symbol : method addKeyListener (mainServerImpl)
    location: class mainServerImpl
    addKeyListener(this);
    I did implement KeyListener. But just don't know how to solve this error.
    can anyone tell me how to solve it or point me a source that can help.
    Thank in advance!
    Regards,
    Tai Tan

    Write your own Thread, to do this:
    public class KeyThread extends Thread {
       public void run {
          while(true) {
             int i = System.in.read();
             if(i == 123) {
                break; // to stop the thread
    // in your main:
    Thread keyThread = new KeyThread();
    keyThread.start(); // calls run() of the thread

  • Running a Program in JDeveloper using Command Prompt

    Hi,
    I downoladed Oracle JDeveloper 10g. I had written a simple java class called Echo. java. I want to run the file using command prompt. My JDK has the following path:
    F:\Sowmya
    My java file has the following path:
    F:\Sowmya\jdev\mywork\1\1\src\pkg1
    So, in order to compile the file, I gave the following command:
    F:\Sowmya\jdk\bin>javac F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo.java
    It worked and the Echo.class file was created.
    But, when I tried to run the file using the following command,
    F:\Sowmya\jdk\bin>java F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo
    Iam getting the following error:
    Exception in thread "main" java.lang.NOClassDefFoundError: F:\Sowmya\jdev\mywork\1\1\src\pkg1\Echo
    This didnt work either:
    F:\Sowmya\jdk\bin>java F:\Sowmya\jdev\mywork\1\1\classes\pkg1\Echo
    Iam getting the same error.
    Can any one please help me regarding this.
    Thank you,
    Sowmya.

    Yes, my class contains a main. It runs if I click run in JDeveloper. But, there is no output displayed. The following is the code:
    public class Echo {
    public static void main (String[] args) {
    for (String s: args) {
    System.out.println(s);
    }

  • Cant run a program from command prompt

    i am using eclipse 3.2 for java development.
    programs are running from editor window, but whenever i am trying to run it from command prmpt , i am getting folowing error...
    ..........NoClassDefinitionFound
    how to resolve it...??
    regards
    yogesh g k

    Since there have been a lot of posts from people who fail to compile and run their correct code, I would like to suggest to use ant for building and running! It hides the complexities of specifying the correct paths and a lot it's easier to type
    prompt>ant
    at the command line than
    prompt>javac -d . -cp .;longListOfJarsNeededToRun somePackage/*.java aLotOfOtherFilesToCompile.java
    prompt>java -cp .;longListOfJarsNeededToRun somePackage.someClass
    It takes some time to get familiar with the configuration, but once you get it right, you gain back a lot of your invested time!

  • How to run a java program in command prompt

    hi i want to run a java program from in command prompt from another directory
    i want to run a file named First in C:\Program Files\Java\jdk1.6.0_07\bin
    so when i give the command
    java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
    it doesnt works it shows
    C:\>java "C:\Program Files\Java\jdk1.6.0_07\bin\First"
    Exception in thread "main" java.lang.NoClassDefFoundError: C:\Program Files\Java
    \jdk1/6/0_07\bin\First
    Caused by: java.lang.ClassNotFoundException: C:\Program Files\Java\jdk1.6.0_07\b
    in\First
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: C:\Program Files\Java\jdk1.6.0_07\bin\First. Pro
    gram will exit.

    but it prints
    C:\>java -cp "C:\Program Files\Java\jdk1.6.0_07\bin\" First
    Usage: java [-options] class [args...]
    (to execute a class)
    or java [-options] -jar jarfile [args...]
    (to execute a jar file)
    where options include:
    -client to select the "client" VM
    -server to select the "server" VM
    -hotspot is a synonym for the "client" VM [deprecated]
    The default VM is client.
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    A ; separated list of directories, JAR archives,
    and ZIP archives to search for class files.
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -version:<value>
    require the specified version to run
    -showversion print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
    include/exclude user private JREs in the version search
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    -agentlib:<libname>[=<options>]
    load native agent library <libname>, e.g. -agentlib:hprof
    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
    load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
    load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
    show splash screen with specified image
    C:\>

Maybe you are looking for

  • Export to Excel - Multiple Tables in a single details section

    Hi All, I have a set of reports where I am using a single details section to show multiple tables stacked over one another. That is, i have a table with three columns and two rows, followed by some white space and then another table with 4 columns an

  • Iframe src bound to backend bean url

    Hello there, I have a jspx page with an iframe. I would like to bind the src of that iframe to an url which is in my backend bean - populated by reading a property file. Here the code. .jspx <f:verbatim> <IFRAME src="http://my.oracle.com" frameborder

  • Intercepting SOAP XML message in JAX-RPC Handler and calling a diff method

    Is it possible to intercept the SOAP XML message in the JAX-RPC handler and avoid the serialization and deserialization (OR avoid XML data binding) Here is a more detail question My web service has two methods 1. One Method which accepts Java Object

  • Network backup to external HD not working well

    So I've got a Macbook and an iMac. I have a 500GB external firewire hard drive permanently plugged into the iMac and always on. The iMac has no problems backing up. However, the laptop has problems. I can set it up and it starts working just fine. Th

  • Send link or item in toolbar to desktop

    HOW CAN I SEND AN ITEM IN MY TOOLBAR TO MY DESKTOP?