Requesting user input from UNIX command window

New to this forum, and relatively new to Java......question for you......
Currently, I am able to request a .txt file from a user in my unix command window by having them type in the following command:
java Game (nameOfTextFile).txt
with the following code:
public class Game {
public static void main(String[ ] args) {
try{
reader = args[0];
catch(Exception g){
System.out.println(g);
where 'reader' holds the .txt file.
What I would like to do is as soon as the user types in the command:
java Game
it gives them the line:
"Please type the file to be input"
and at this point they type in:
(nameOfTextFile).txt
and then I can start working with the text file.
Any ideas?
Thanks

public class Game {
public static void main(String[ ] args) {
try{
reader = args[0];
catch(Exception g){
System.out.println(g);
}This class will not compile. The variable 'reader' is not declared anywhere.
You could create a shell program. When the user enters the name of the shell program at the command prompt, it gives them the prompt to enter the file to be input. And then from within the shell program you call the java program with the name of the file.

Similar Messages

  • How to capture user inputs from Enter_query command?

    When the user enters query(F7) and inputs some field parameters...how do I capture those variables after they execute the query?
    Example:
    -Table ABC has a column called NAME
    -They enter '%BOB% in the NAME field
    -They press F8 (enter-query)
    I've tried using:
    message( get_block_property('ABC', DEFAULT_WHERE)) to see what's in there and it returns a null. I know that if I hit F7 twice, I can see '%BOB%' displayed in the field. Is there a way to see this without hitting F7 twice?
    Thanks.

    -Table ABC has a column called NAME
    -They enter '%BOB% in the NAME field
    -They press F8 (enter-query)
    ? F8 = execute-query
    however. Use the PRE-QUERY and write your message there and show the value of :ABC.NAME
    that's it
    Gerd
    PS: Without hitting two times F7 you have NO chance to get the value of %BOB%. this is an internal cache mechanism of the forms runtime and only hitting two times F7 gives you the information which forms has remembered in a local cache.

  • Concurrent program to FTP from Unix to windows

    Hi,
    I am trying to FTP files from UNIX to a windows machine. I tried to do it through a shell script but it did not work , so i tried at the command prompt.
    I am able to login and get files from windows to UNIX but I am not able to PUT files.
    I spoke to the admin and he says all permissions are granted on teh remote host. I am able to put files with the same userid from windows to windows but not from UNIX to windows.
    Any ideas why? User id has read/write permissions.
    thanks

    are you sure its a path issue i face the same issue before and find out it was a windwos premission issue
    fadi hasweh
    http://oracle-magic.blogspot.com/
    Oracle is not Magic, it just takes years of experience

  • How to accept user inputs from  sql script

    I want to create Tablespace useing sql script , but the location of the data file I need accept from user . (to get the location of the data file ) .
    How can I accept user input from pl/sql .
    Example :
      CREATE TABLESPACE  TSPACE_INDIA LOGGING
         DATAFILE 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL;here I need to accept location of the datafile from user ie : 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'

    Hi,
    Whenenever you write dynamic SQL, put the SQL text into a variable. During development, display the variable instead of executing it. If it looks okay, then you can try executing it in addition to displaying it. When you're finished testing, then you can comment out or delete the display.
    For example:
    SET     SERVEROUTPUT     ON
    DECLARE
        flocation     VARCHAR2 (300);
        sql_txt     VARCHAR2 (1000);
    BEGIN
        SELECT  '&Enter_The_Path'
        INTO    flocation
        FROM    dual;
        sql_txt :=  'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILE' || flocation || ' "\SRC_TSPACE_INDI_D1_01.dbf" ' || '
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL ';
        dbms_output.put_line (sql_txt || ' = sql_txt');
    --  EXECUTE IMMEDIATE sql_txt;
    END;
    /When you run it, you'll see something like this:
    Enter value for enter_the_path: c:\d\fubar
    old   5:     SELECT  '&Enter_The_Path'
    new   5:     SELECT  'c:\d\fubar'
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILEc:\d\fubar
    "\SRC_TSPACE_INDI_D1_01.dbf"
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE
    UNLIMITED
         EXTENT MANAGEMENT LOCAL  = sql_txt
    PL/SQL procedure successfully completed.This makes it easy to see that you're missing a space after the keyword DATAFILE. There are other errrors, too. For example, the path name has to be inside the quotes with the file name, without a line-feed between them, and the quotes should be single-quotes, not double-quotes.
    Is there some reason why you're using PL/SQL? In SQL, you can just say:
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
    DATAFILE  '&Enter_The_Path\SRC_TSPACE_INDI_D1_01.dbf'
    SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
    EXTENT MANAGEMENT LOCAL;though I would use an ACCEPT command to given a better prompt.
    Given that you want to use PL/SQL, you could assign the value above to sql_txt. If you need a separate PL/SQL variable for flocation, then you can assign it without using dual, for example:
    DECLARE
        flocation     VARCHAR2 (300)     := '&Enter_The_Path';The dual table isn't needed very much in PL/SQL.
    Edited by: Frank Kulash on Jan 10, 2013 6:56 AM

  • Request user input message format

    When using the request user input function it sends an e-mail that is very hard to read for end user and I not able to see which e-mail template that is being used so I can change the format.

    Hi,
    Please create Notification Templates in System Center Service Manager by following the link below:
    Creating Notification Templates in System Center Service Manager
    http://blogs.technet.com/b/servicemanager/archive/2009/09/28/creating-notification-templates-in-system-center-service-manager.aspx
    And also check the article below to know more details about how to create requesting input from user:
    Requesting Input from User About an Incident
    http://blogs.technet.com/b/servicemanager/archive/2009/12/13/requesting-input-from-user-about-an-incident.aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Transfer file from UNIX to windows application server G:\ drive

    Dear Expert,
    Really need some help on this, very urgent !
    The download program schedule in background to allow file store in unix.
    Can we do a unix command in abap program to transfer the file from unix to windows application server G:\ drive.
    The gateway for that application server is ukblmqg02.emea.astrazeneca.net .
    Anyone have the sample source code ?
    Thanks&regards
    Nislina

    Hi,
    1.
    There is  a FM 'ARCHIVFILE_SERVER_TO_CLIENT'.
    If the requirement need not necessarily require a FM to transfer a file, then you can also use transaction 'CG3Y' to transfer a file
    from application server to presentation server.
    2.
    Try to use FM  DOCFILE_SERVER_TO_CLIENT. I am using it to download a file from SAP application server to desktop.
    Source path should be application server file path along with file name i.e. /tmp/sample.xls.
    Target path should be something like c:\file.xls.
    Best regards,
    Prashant

  • Make System.in read input from a command prompt

    How can i make System.in read input from a command prompt which is opened after program
    is started. Please note that program starts without commad promt. Can u plz help?
    sharmila

    System.in DOES read from the command shell that you start the app in.
    What you don't have is a prompt.
    You should know about Java Almanac. There are code samples for simple things like I/O that everyone should know about. There's an example there to help you.
    MOD

  • How to change Syntax group and physical path in SARA from unix to windows.

    Our customer migrate current current archiving server from Unix to windows
    How to change Syntax group and physical path in SARA from unix to windows.

    http://help.sap.com/saphelp_nw70/helpdata/EN/8d/3e4ec2462a11d189000000e8323d3a/frameset.htm
    you have to change
    Logical Path Names
    Logical file  Names
    Note 35992 - File name/directory for application archiving
    hope this will help you
    cheers
    dEE

  • Database shifting from UNIX to WINDOWS

    Hi,
    We have a production server located at Suse UNIX.
    We would like to move database from UNIX to WINDOWS.
    I would like to know what are the difficulties/scenarios which occures while moving the database?
    How difficult is it to import current oracle database to oracle on windows server ?
    Please explain in details.
    Thanks,

    hi what is your version of database?
    are you chaging the database version also or simply operating system?
    if you are only changing OS, then exp/imp is the best option. but to acheive this you need to do some groundwork like collecting all the tablespaces information and schemas and their privileges etc.
    also depends on database size also you can choose come other options.
    if your database version is 10g then you can best use the option of datapump exp/imp or network_link parameter of datapump.

  • Where to validate user input from FPM_FORM_UIBB?

    I am supporting an ESS OVP app using WDA and FPM. 
    This question concerns validating/changing user input from an edit page entered through FPM_FORM_UIBB
    In a form, on an edit page, we wanted to mask the initially loaded value of a field with asterisks.
    I used the feeder class get_data() method to accomplish this.
    The user may then overtype the asterisks with content data.  At times, the user leaves some of the asterisks there as well.
    I want to check the contents of the inpu field, and, if needed, compress out the asterisks.
    if not inputfield co '* ' .
    translate inputfield using '* ' .
    condense inputfield NO-GAPS .
    endif .
    Where can I put this code? Or, where, generally, do you code validations of form data?
    Thanks…  
    …Mike

    Hi Mark,
    You should be able to catch the event in PROCESS_EVENT and GET_DATA. I would put the break-point in both of these methods and check for the field values and based on that decide course of action. So steps would be.
    1) Put in the break-points in the obove methods.
    2) Check the event and the field values you are intrested in.
    3) Code accordingly.
    Hope it helps.
    Laeeq Siddique

  • Is it possible to fire an ibot from unix command line?

    Hi,
    Is it possible to fire an ibot from unix command line?
    I am looking to setup a setp in a job in grid control which runs a report in order to create a cached file on the obiee server once a prior step has completed. Is this possible?

    Hi,
    Did you check this?
    is it possible to execute ibot..
    Rgds,
    Dpka

  • User input from pl/sql

    How could I get user input from a pl/sql block?
    Hope that somebody can help me.
    thanx
    Amelio.

    There is a package DBMS_LOCK that has a SLEEP routine, which suspends the session for a given period of time (in seconds).
    However, you can only pause the procedure and not accept user input into the procedure during the pause.
    syntax: DBMS_LOCK.SLEEP(1) ;
    I need only to run an 'pause' or something like that within a pl/sql block. Do you know if it's possible? Thanks.

  • Selecting user input from Select option into smart form

    Hi,
    when i use parameter then i wil show company code in smart-form output
    but when i use  select option then its throwing error parameter specified here is different
    what should i do in this case i want to design a big select option screen for taking user input
    REPORT  ZMM.
    TABLES BSEG.
    DATA : V_FORMNAME TYPE TDSFNAME VALUE 'ZPUR_REG',
           V_FMNAME TYPE RS38L_FNAM.
    *PARAMETERS SO_BUKRS TYPE BUKRS.
    SELECT-OPTIONS : SO_BUKRS FOR BSEG-BUKRS.
    DATA : Z_CONTROL TYPE SSFCTRLOP,      "Smart Forms: Control structure
            Z_OPTIONS TYPE SSFCOMPOP.      "SAP Smart Forms: Smart Composer (transfer) options.
    MOVE 'X' TO : Z_control-no_dialog,        "SAP Smart Forms: General Indicator
                   Z_options-tdnewid,          "New Spool Request (Print Parameters)
                   z_control-PREVIEW.         "Print preview
    MOVE 'LP01' TO Z_options-tddest.         "Spool: Output device
    MOVE space  TO Z_options-tdimmed.        "Print Immediately (Print Parameters).
    MOVE 'PRINTER' TO Z_control-device.      "Output device
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME = V_FORMNAME
      IMPORTING
        FM_NAME  = V_FMNAME.
    CALL FUNCTION V_FMNAME
      EXPORTING
        CONTROL_PARAMETERS = Z_CONTROL
        OUTPUT_OPTIONS     = Z_OPTIONS
        USER_SETTINGS      = ''
        BUKRS              = SO_BUKRS.
    pls help me in this regards.
    ketan..

    hi
    thnx for your reply
    can u pls elaborate in my code
    now i changed code   BUKRS    = SO_BUKRS-low.
    either i can give low or high but how to select from range
    REPORT  ZMM.
    TABLES BSEG.
    DATA : V_FORMNAME TYPE TDSFNAME VALUE 'ZPUR_REG',
           V_FMNAME TYPE RS38L_FNAM.
    *PARAMETERS SO_BUKRS TYPE BUKRS.
    SELECT-OPTIONS : SO_BUKRS FOR BSEG-BUKRS.
    DATA : Z_CONTROL TYPE SSFCTRLOP,      "Smart Forms: Control structure
            Z_OPTIONS TYPE SSFCOMPOP.      "SAP Smart Forms: Smart Composer (transfer) options.
    MOVE 'X' TO : Z_control-no_dialog,        "SAP Smart Forms: General Indicator
                   Z_options-tdnewid,          "New Spool Request (Print Parameters)
                   z_control-PREVIEW.         "Print preview
    MOVE 'LP01' TO Z_options-tddest.         "Spool: Output device
    MOVE space  TO Z_options-tdimmed.        "Print Immediately (Print Parameters).
    MOVE 'PRINTER' TO Z_control-device.      "Output device
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME = V_FORMNAME
      IMPORTING
        FM_NAME  = V_FMNAME.
    CALL FUNCTION V_FMNAME
      EXPORTING
        CONTROL_PARAMETERS = Z_CONTROL
        OUTPUT_OPTIONS     = Z_OPTIONS
        USER_SETTINGS      = ''
        BUKRS              = SO_BUKRS-low.
    ketan..

  • Working Code from Unix Command, needs fixing!

    /* Codes needs modification to run and display in GUI, will run and produce output in terminal, but will not display in GUI with setText and getText */
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class UnixCommand extends JFrame
    private JComboBox comboBox;
    private JTextArea displayArea;
    private JPanel mainPanel, displayPanel, comboPanel;
    private String names[] = { "Check Processes", "Check Network Connectivity",
                        "Check Remote Users", "Check Share Devices" };
    TitledBorder selectBorder, displayBorder;
    public UnixCommand()
         super( "Unix Command Tools in GUI" );
         Container container = getContentPane();
         mainPanel = new JPanel( new BorderLayout() );
         container.add( mainPanel );
         displayPanel = new JPanel();
         comboPanel = new JPanel();
              mainPanel.add( displayPanel, BorderLayout.CENTER );
              mainPanel.add( comboPanel, BorderLayout.NORTH );
                   comboBox = new JComboBox( names );
                   comboBox.setMaximumRowCount( 3 );
                   comboPanel.add( comboBox );
                        selectBorder = BorderFactory.createTitledBorder( "Select the Task to Perform" );
                        selectBorder.setTitlePosition( TitledBorder.TOP );
                        comboPanel.setBorder( selectBorder );     
                   displayArea = new JTextArea( 22, 40 );
                   displayPanel.add( displayArea );
                        displayBorder = BorderFactory.createTitledBorder( "The Command Output Selected" );
                        displayBorder.setTitlePosition( TitledBorder.BOTTOM );
                        displayPanel.setBorder( displayBorder );
    String s = null;
         displayArea.setText("\tHere is the standard output of the command:\n");
    try
                             // run the Unix "ps -ef" command
    Process p = Runtime.getRuntime().exec("ps -ef");
    BufferedReader stdInput = new BufferedReader(new
    InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new
    InputStreamReader(p.getErrorStream()));
                        // read the output from the command
    System.out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null)
    System.out.println(s);
                        // read any errors from the attempted command
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null)
    System.out.println(s);
    System.exit(0);
    catch (IOException e)
         System.out.println("exception happened - here's what I know: ");
         e.printStackTrace();
         System.exit(-1);
    setSize( 500, 500 );
    setVisible( true );
    public static void main( String args[] )
         UnixCommand application = new UnixCommand();
         application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }

    All files are regenerated if changed.
    That goes for the .java and the .class files that are created. The jsp server checks to see if the current version is the latest. If it is, nothing gets changed or recompiled. If things are different, programs are recompiled.
    Youll notice that if you have a new jsp it always takes longer the first time. Or even when you change a jsp, the first time takes the longest for the page to come up in a browser. This is because of recompiling.
    Does this make any sense?
    Adam

  • User Input from Text File

    Hello
    I would like to incorporate code into this to allow the script I found on the internet to pull input from a txt file and then wait for the script to end before using the next entry in the text file and run until all entries in the text file have been used.
    Any help would be great thx.
    Jason
    ' Get Options from user
    GetOptions
    If (bInvalidArgument) Then
        WScript.Echo "Invalid Arguments" & VbCrLf
        bDisplayHelp = True
    End If
    If (bDisplayHelp) Then
        DisplayHelp
    Else
        If (bCheckVersion) Then
            CheckVersion
        End If
        If (strComputer = "") Then
            strComputer = InputBox("What Computer do you want to document (default=localhost)","Select Target",".")
        End If
        If (strComputer <> "") Then
            ' Run the GatherWMIInformation() function and return the status
            ' to errGatherInformation, if the function fails then the
            ' rest is skipped. The same applies to GatherRegInformation
            ' if it is successful we place the information in a
            ' new word document
            errGatherWMIInformation = GatherWMIInformation()
            If (errGatherWMIInformation) Then
                If (bDoRegistryCheck) Then
                    errGatherRegInformation = GatherRegInformation
                End If
                GetWMIProviderList
            Else
                WScript.Quit(999)
            End If
            If (bHasMicrosoftIISv2) Then ' Does the system have the WMI IIS Provider
                GatherIISInformation
            End If
            SystemRolesSet
            If (errGatherWMIInformation) Then
                Select Case strExportFormat
                    Case "word"
                        PopulateWordfile
                    Case "xml"
                        PopulateXMLFile
                End Select
            End If
        End If
    End If

    Unfortunately the script is too long to be posted but can be found at
    http://sydiproject.com/download/and is called Server v.2.3. I have also contacted the author and made the suggestion I
    asked about.
    Jason
    I do not know which script you had in mind but the one I looked at had 1,600 lines of code. As you say, posting it here would be inappropriate. At the same time it is unrealistic to ask for help for such a large script. Asking the author is one option. The
    other option would be to identify the module you wish to modify, analyse it until you fully understand it, modify it so that you can run it in a stand-alone manner, then post your question here. You will probably find that you can answer the question yourself
    after analysing the code!

Maybe you are looking for

  • Create navigation cue points in a FLV file using Media Encoder CC

    When I export a FLV file with Navigation cue points created in Media Encoder CC (by loading a cue points XML file), upon examining the file I see that the cue points are recorded as Event type cue points in the metadata at the top of the file. When I

  • Word Docs vs Notepad Docs

    I am unable to open notepad docs. The words are garbled...what does this mean and how can it be fixed?

  • Dynamic Case Expression

    select  count(*)   from  vwsr_all_merged_data s where  sr_tio_priority in ('Level 0','CEO','TER','Priority Assistance','Enquiry')    and  sr_status = 'Open'    and  SR_BUS_UNIT IN ('Business Support and Improvement','Finance and Administration','Cust

  • SAP Interactive forms for external consumption

    Dear Experts, We have a requirement in one of our projects to expose our SAP Interactive forms for external consumption. This services are in ICF currently and I am trying to get them into ODATA repository. I have even created a model for that but un

  • 6 hour to get a refund after being charged twice a...

    Has anyone had a problem being charged twice? I tried to renew my Unlimited Europe subscriptions.  I paid by transfer the required €57.50  by bank transfer the next day i received an Email saying "Unfortunately, your payment failed, but don't worry,