Clear Command Line Console from Java

Is there a way to clear the dos/shell console screen from a java program (the same way as cls would do in dos ir clear would do in unix) without making a Runtime.exec call??
Thanks for your time
wwe8

What console window are you talking about?
1- You might be starting a java application in a console window.
2-Or it might be another console window.
3-You might be starting a console window in java via Runtime.exec().
For 1 and 2 you would need a JNI, platform specific solution. I believe the java testing tools do this, so if you got one of those it might provide an interface for this.
If 3, then you would use the input stream to pass the command to the window.

Similar Messages

  • Command line args from java to C++

    Hi
    I want to pass command line arguemnts argc and argv from java to C++. I have browsed the net and most of them suggested that I declare the jni statement with jObjectarray.
    I saw an example at http://www.csc.calpoly.edu/~fouzi/crossroads/Arguments.c
    It said
    #include "/home/java/linux/jdk118/include/jni.h"
    #include "Arguments.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL
    Java_Arguments_setArgs (JNIEnv *jenv, jobject job, jobjectArray oarr)
    /* obtain the size the the array with a call to the JNI function
    GetArrayLength()                              */
    jsize argc = (*jenv)->GetArrayLength(jenv, oarr);
    /* Declare a char array for argv */
    char const* argv[128];
    int i;
    for (i = 1; i < argc + 1; i++) {
    /* obtain the current object from the object array */
    jobject myObject = (*jenv)->GetObjectArrayElement(jenv, oarr, i-1);
    /* Convert the object just obtained into a String */
    const char str = (jenv)->GetStringUTFChars(jenv,myObject,0);
    /* Build the argv array */
    argv[i] = str;
    /* print the argv array to the screen */
    printf ("argv[%i] = %s\n",i,argv);
    /* Free up memory to prevent memory leaks */
    (*jenv)->ReleaseStringUTFChars(jenv, myObject, str);
    // Increment argc to ajust the difference between Java and C arguments
    argc++;
    // Call a pipeline simulator function which uses command line arguments
    start(argc,argv);
    return;
    That is what I have where the start method is declared like this:
    void start(int argc, /* Argument count */ char argv[] / Argument strings */) {
    But I get a warning when I build the C routine. The warning arises when I am calling the start method.
    The warning says:
    f:\jni\dsaccess.c(711) : warning C4090: 'function' : different 'const' qualifiers
    f:\jni\dsaccess.c(711) : warning C4024: 'start' : different types for formal and actual parameter 2
    Can you help?
    Thanks
    Lakshmi

    1. Your array building looks bogus: Are you missing an index?
    2. You claim to be calling a "method". Are you? Or is it a subroutine?

  • How to run a command line window from code?

    In an application I need to run a dll file with a few arguements. These arguements can be given in the command line window. The execution of the dll file will return a string that i need to get (for the parsing etc).
    1. How can I open a command line window from the Java code?
    2. How to run commands on it?
    3. How to get the results of the commands from the command line into my program?

    In an application I need to run a dll file with a few
    arguements. These arguements can be given in the
    command line window. The execution of the dll file
    will return a string that i need to get (for the
    parsing etc).
    A dll is used by other programs. It is not possible to run it from the command line.

  • How to hide the command line arguments from solaris process

    Hi All,
    When I execute a JAR application from a java file using the Runtime.getRuntime, the command line arguments (user ID and Password details) which I passed for executing the application displayed on Solaris process (ps -ef).
    Could anybody please help me, how can I hide either the process or the command line arguments from the Solaris process?
    I cannot pass any asterix or any special character in place of password, because the executing application doesn't have any functionality to retreive the password which send as asterix characters.
    Please help me
    SumodeV

    Thanks for all the response.
    I have created a design and implement the functionality which executes the JAR application in Solaris environment without showing any details in the process details.
    I have used the Java Reflection method, which invokes the JAR application. I am sharing the details here for all those who looking for it.
    1, Inside the Customer application [Jar File is running for it], collect the necessary session details [Using System.get property method]
    2, Create an independent Java file, which should be used to invoke the JAR application
    3, Create the ProcessBuilder object and use a command - execute the Java file [a wrapper code] using normal Java command
    4, Pass the necessary session details to the ProcessBuilder using the environment() function.
    5. Collect the environment values in the independent Java file (Which was invoked by ProcessBuilder) and set details for its environment using System.setProperty.
    6, Use reflection technique to invoke the JAR plugin [which you want to run]. You can use the standard Java functionality to read the MANIFEST file of JAR and load the main class using URLClassLoader.
    7, Invoke the main method of the JAR file, which run the JAR application in Solaris window
    This solution will make sure that the process cannot display any session details in the Solaris Environment.
    Note: Use String[] array while create the command. Otherwise the JAR application cannot pop-up.
    Regards
    Sumode

  • Command line console, any decent package?

    Hello there:
    I was given an assignment to write a simple adventure game, command line console is to be used to accept user instructions. While we can create a traditional while-loop to take users' requests, i am wondering if there is any decent package to handle commands from a console in a general way? It'd be a great time-saver in one's repository. :-)
    Thanks,
    Sway

    No packages that I know of, but take a look at the Scanner Class. Last time I did a Zork type of game it took like 2 hours to code up--with monster definitions, potions, and healing. You'll not get much more easy of an assignment for than a text based game.

  • Clear Command Line

    Hi all would like to know if there is anyway i can clear the stuff already present in the command line promt using java.
    Thanks

    No.
    Shell commands must be executed by the shell. Your shell is already executing a command - your application. So they can't execute something else.
    You can just print out a bunch of blank lines.

  • Launching command containing pipe from Java

    Hi,
    i have some troubles to launch a command containing pipe from java.
    I've tried to backslash the pipe but it still not work.
    Maybe someone has an idea about that :
    head -102050 /data/a_very_big_file | tail -5
    the idea is to get 5 lines in the middle of a very big file.
    To launch commands from java i use i think the classical way,
    something like :
    Process p = Runtime.getRuntime().exec(commande[0], this.envp, new File(this.pathExecution));
    I obtain this error :
    ERROR : head: invalid option -- 5
    ERROR : Try `head --help' for more information.
    Thanks for your help,
    kevin.

    kevleb wrote:
    yes same result...
    but i think the problem come from the fact
    that when you pipe your result of a command,
    you launch an other process (is that true).i don't know if another process is launched (the probability is rather high, though)
    but even if that's the case, from the time you rely on a shell and not directly on exec(), i think it shouldn't be a problem to include a | inside the command ; i don't have an idea why it gives you that message error :\

  • Not cleared two line items from the GR/IR clearing

    For one of the items in PO following transactions are done...
            Mtype   Date            Quantity             Amount
    GR   101    06/14/09        1 02.001            887.85
    GR   102    06/14/09        102.001-            887.85
    GR   101    06/14/09        101.999             887.85
    GR   101    07/22/09        102.001             923.61
    IR-L            06/14/09        102.001            887.85
    IR-L            06/14/09        101.999            887.85
    FBL3N: out put
    Open items
    Doc Type  Date                           Amount
    WE           06/14/2009 86            887.85
    WE           07/22/2009 96            923.61-
    Cleared items:
    Doc Type  Date                           Amount                                                                     
    WE            06/14/2009  96              887.85-
    Z9             06/09/2009  86              887.85
    WE            06/14/2009  96              887.85-
    Z9             06/09/2009  86              887.85
    System has not cleared two line items from the GR/IR clearing for this line item in PO.
    What could be the reason these items are not cleared and now how these line
    items can be cleared?

    Hi,
    When the Dr and Cr amount are equal to zero system will automatically clear the line items in F.13.  Here the open items are appearing with different amounts due to that system not able to clear.
    By passing some manual JV or something you done to make Dr and Cr equal to zero then you clear through F-03(untick post automatically for this clearing in T.cdoe FS00)
    Regards,
    Sankar

  • Clear the Filter Criteria from java code programmatically

    Hi All,
    I am using jdev version 11.1.1.6.0.
    I do have ADF table for which I have added filter to each column .
    I created table using java class data control.
    Filter is working Fine .
    My use case is-
    When I click on search button data is populated in table.
    When anybody enters filter value in column suppose product and hit enter ,it filters data.
    if he clears and do not hit enter key and search again then it does not show all data it only show filtered data.
    So how can I programmatically clear all filters so on click of  search it will show all the values not filtered values.
    I have not used default Filter Behavior.
    Please check below code for reference
      <af:table value="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSet}"
                                  var="row"
                                  rows="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  emptyText="#{bindings.AfMyAccOrderStatusHistorySearchVO.viewable ? 'No data to display.' : 'Access Denied.'}"
                                  fetchSize="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  rowBandingInterval="0" id="tblStatusHistoryList"
                                  autoHeightRows="#{bindings.AfMyAccOrderStatusHistorySearchVO.rangeSize}"
                                  rowSelection="single"      
                                  width="100%"
                                  partialTriggers="::cb5 ::cb8 ::cb1 ::cb2"
                                  filterModel="#{bindings.AfMyAccOrderStatusHistorySearchVO1Query.queryDescriptor}"
                                  queryListener="#{bindings.AfMyAccOrderStatusHistorySearchVO1Query.processQuery}"
                                  filterVisible="true" varStatus="vs"
                                  binding="#{AfMyAccOrderStatusHistoryAction.orderStatusHistorySearchList}">
    <af:column headerText="#{alfaprojectBundle['ordstatushistory.column.invoiceDate']}"
                                      width="70"
                                      sortProperty="invoiceDate"
                                      sortable="true" filterable="true"
                                      id="c7" filterFeatures="caseInsensitive">
                              <af:outputText value="#{row.invoiceDate}" id="ot16"/>
                            </af:column>                     
                            <af:column headerText="#{alfaprojectBundle['ordstatushistory.column.soldto']}"
                                       width="100"   
                                       sortProperty="soldTo"
                                       sortable="true" filterable="true"
                                       id="c14" filterFeatures="caseInsensitive">
                              <af:outputText value="#{row.soldTo}"
                                             visible="#{row.visibilityIsOrdrFirstItem}"
                                             id="ot23"/>
                            </af:column>
    So how to clear all filter values from java code.

    I can't get the example "Programmatically Manipulating a Table's QBE Filter Fields"
    Where is it ?
    https://smuenchadf.samplecode.oracle.com/samples/ClearTableColumnFilterFields.zip
    Thks

  • Virtual Command Line Console

    If you ever need to open an SR for an issue with a snapshotted application, or simply want to do some basic testing prior to building a virtual application that requires snapshotting, a virtual command line console is an excellent tool:
    1. Open ZAV studio
    2. Start a new project
    3. Point the startup file to C:\WINDOWS\system32\cmd.exe
    4. Point the output file to any location you wish
    5. Build
    To test:
    1. Run the virtual CMD.exe
    2. Navigate to the location of the installed exe you want to virtualize and run it
    The purpose of this test is simple: as we have not modified the configuration at all and have included no virtual file system or registry, this virtual CMD is running inside the xVM and using the file system/registry of the OS. This strips away all of the packaging elements that go into the snapshot process, allowing the cleanest possible test.
    If the installed application runs under these conditions, but fails to operate correctly when built into a virtual application, there is something going wrong in the packaging process. This could be a file being left out of the virtual file system, or a setting that needs to be in place, etc. If the installed application fails to operate correctly using the virtual CMD, however, there is a more serious issue; an SR should absolutely be opened if possible, so the support team can assist.

    this is an xwindows error meaning you haven't setup xwindows properly in the context where you're running the program - is it in a unix shell ? Do you have an XServer running ?

  • Mail bounces when sent from command-line, works from PHPMailer, Mail.app

    Recently, any mail send from the command-line (manually, or via automated scripts) is getting rejected. However, messages composed with, say, PHPMailer are getting through. One thing I notice about the bounced messages is that there's no user/sender recorded. Here's a snippet of the log:
    Sep 28 16:45:32 ns postfix/pickup[3275]: 64F57343FF2: uid=501 from=<admin>
    Sep 28 16:45:32 ns postfix/cleanup[6126]: 64F57343FF2: message-id=<[email protected]>
    Sep 28 16:45:32 ns postfix/qmgr[3276]: 64F57343FF2: from=<[email protected]>, size=627, nrcpt=1 (queue active)
    Sep 28 16:45:35 ns postfix/smtp[6130]: 64F57343FF2: to=<[email protected]>, relay=mx.metropolis.ca[65.254.254.57], delay=3, status=sent (250 2.0.0 tylR1X05q2fRSSh0000000 mail accepted for delivery)
    Sep 28 16:45:35 ns postfix/qmgr[3276]: 64F57343FF2: removed
    Sep 28 16:45:54 ns postfix/pickup[3275]: 0A7BB343FFF: uid=501 from=<admin>
    Sep 28 16:45:54 ns postfix/cleanup[6126]: 0A7BB343FFF: message-id=<20070928224554.0A7BB343FFF@mail>
    Sep 28 16:45:54 ns postfix/qmgr[3276]: 0A7BB343FFF: from=<[email protected]>, size=423, nrcpt=1 (queue active)
    Sep 28 16:45:54 ns postfix/smtp[6130]: 0A7BB343FFF: to=<[email protected]>, relay=none, delay=0, status=bounced (mail for gpspolice.net loops back to myself)
    The failure reason given "mail for ... loops back to myself" doesn't seem right, since I haven't changed the DNS settings on this machine.
    You'll notice, the message that is sent has the from= address specified, whereas the other two failed examples don't... I'm not really sure why this is failing all of a sudden. Telus, one of our ISPs, is infamous for quietly making major network policy changes (e.g., blocking port 25 for all outgoing business customers). Any suggestions, or a link to a good SMTP mail server (a la OS X server) tutorial would be appreciated. Thanks.
    ...Rene

    David_x wrote:
    David_x wrote:
    Can you explain why you need any zones in your DNS apart from your own?
    OK, I read a previous post from you which explains your internal setup (mini & xserve), so you are using internal domains for web stuff with your local DNS based on your xserve. I presume your mini is using the xserve for DNS? So although I am not entirely clear about everything that is going on, I'll presume you do need these domains in your xserve...
    Yes, that's all correct. The Xserve does runs DNS, Web and Mail Services, the Mini just runs a couple web sites (on port 8080, fwiw).
    If an external mail server is responsible for a domain which you have in your internal DNS then you have to mirror the public MX records in your local DNS. How MX records work...
    This is what I've done in the DNS Services, I believe...
    For the domain gpspolice.net, your mini will ask your xserve for the MX record. This will resolve to a host name - in the public DNS this is "mail.gpspolice.net". Your mini will then ask your xserve to resolve this host name - in the public DNS this is "209.200.253.29". So ideally, you should have these two records (MX record= mail.gpspolice.net, plus "A" record for mail.gpspolice.net = 209.200.253.29) in your xserve dns. You may get away with using a different MX host name as long as the final IP is the same but better if exactly mirrors public DNS records.
    -david
    I think I've done what you've said, and still certain messages don't get sent out. Basically, any message bound for a .baseloc.net domain doesn't get sent. Here's an example of one message that get's stuck in the queue, along with the console log:
    Message ID: 46A1435234C
    Date: Wed Oct 3 09:57:17
    Size: 11009
    Sender: [email protected]
    Recipient(s) & Status:
    [email protected]:
    temporary failure. Command output: couldn't connect to lmtpd: Connection refused_ 421 4.3.0 deliver: couldn't connect to lmtpd_
    Oct 3 21:00:07 ns postfix/pipe[21091]: 46A1435234C: to=<[email protected]>, relay=cyrus, delay=39770, status=deferred (temporary failure. Command output: couldn't connect to lmtpd: Connection refused_ 421 4.3.0 deliver: couldn't connect to lmtpd_ )
    I have to say, I really appreciate your help. It's helping me understand the proper approach. Anyway, if there's any other information I can provide to help you [help me], please let me know. Thanks again.
    ...Rene

  • Permission problems with command line CVS and Java CVS App

    Greetings,
    I'm part of a moderately sized website development team which recently upgraded to MacBook Pros (dual core) running OS 10.4.9. One of the primary tools we use in our day to day work is the open source concurrent versioning system (CVS). We've noticed a distressing issue running CVS on our macbook pros: there seems to be a problem with the way these new machines handle permissions on the directories/files that CVS uses to manage files.
    The error occurs when the CVS application, in this case both command line CVS and GUI CVS application named SmartCVS, tries to rename a temporary file named Entries~ to its new name Entries (no ~). It looks like this:
    java.io.IOException: Could not rename file
    /Users/[USER]/Sites/[MODULE]/lib/CVS/Entries~ to
    /Users/[USER]/Sites/[MODULE]/lib/CVS/Entries
    at smartcvs.JP.a(SourceFile:125)
    at smartcvs.JP.a(SourceFile:113)
    We've noticed that if we open up a get info window on the directory we're downloading, and choose "Apply to enclosed items" right when we start the download process, the issue will be resolved, presumably because the permissions are being set on the subdirectories as the download is taking place.
    We've checked the permissions on the overall ~/Sites/ directory numerous times, and they always seem to be set correctly as drwxr-xr-x. It's within this folder that CVS creates a directory with the CVS module name and downloads all the contained files, so we don't see why it would be having issues completing this successfully. We also checked to ensure the GUI CVS application is running under the current user on the machine: it does.
    Has anyone run into issues like this in the past? Is there more information I could provide to further clarify the problem we're having?
    Thanks for any input you have!

    Thanks for asking Jeff, yes one place we are seeing this error is Java application SmartCVS, though the results posted here are from a normal command line CVS checkout.
    ===
    Checkout command:
    cvs co [MODULE]
    ===
    Error:
    cvs [checkout aborted]: cannot rename file CVS/Entries.Backup to CVS/Entries: No such file or directory
    ===
    ID:
    uid=502([USER]) gid=502([USER]) groups=502([USER]), 81(appserveradm), 79(appserverusr), 80(admin)
    ===
    LS -ALN
    Computer:~/Sites [USER]$ ls -aln
    drwxr-xr-x 28 502 502 952 Jun 4 13:11 Sites
    Computer:~/Sites/[MODULE] [USER]$ ls -aln
    drwxr-xr-x 38 502 502 1292 Jun 4 13:33 www_root
    Computer:~/Sites/[MODULE]/www_root [USER]$ ls -aln
    drwxr-xr-x 32 502 502 1088 Jun 4 13:33 [SUBDIR1]
    Computer:~/Sites/[MODULE]/www_root/[SUBDIR1] [USER]$ ls -aln
    drwxr-xr-x 5 502 502 170 Jun 4 13:33 [SUBDIR2]
    Computer:~/Sites/[MODULE]/www_root/[SUBDIR1]/[SUBDIR2] [USER]$ ls -aln
    drwxr-xr-x 4 502 502 136 Jun 4 13:33 [SUBDIR3]
    Computer:~/Sites/[MODULE]/www_root/[SUBDIR1]/[SUBDIR2]/[SUBDIR3] [USER]$ ls -aln
    drwxr-xr-x 6 502 502 204 Jun 4 13:33 CVS
    Computer:~/Sites/[MODULE]/www_root/[SUBDIR1]/[SUBDIR2]/[SUBDIR3]/CVS [USER]$ ls -aln
    total 32
    drwxr-xr-x 6 502 502 204 Jun 4 13:33 .
    drwxr-xr-x 4 502 502 136 Jun 4 13:33 ..
    -rw-r--r-- 1 502 502 45 Jun 4 13:33 Entries
    -rw-r--r-- 1 502 502 45 Jun 4 13:33 Entries.Log
    -rw-r--r-- 1 502 502 48 Jun 4 13:33 Repository
    -rw-r--r-- 1 502 502 63 Jun 4 13:33 Root
    MacBook Pro / MacPro Mac OS X (10.4.9)

  • Passing command line argument in java

    I was writting a calendar pogram that took user input from the command line. What I want to know is how can I write my program so that if the user doesn't enter the info. it will automatically assign a value to the variable in the array, eg:
    if they typed: java calendarmonth 10 2005
    they would get a printout for the calendar month of October 2005, but I want it so that if they typed
    java calendarmonth 10
    it would automatically assign they year to be the current year, and if they typed
    java calendarmonth
    it would auctomattically assign the current month and year to the program, heres the source code:
    import javax.swing.JOptionPane;
    import java.util.*;
    public class calendarmonth {
         /** Main method */
         public static void main(String argv[]) {
              String monthString = argv[0];
              int month = Integer.parseInt(monthString);
              String yearString = argv[1];
              int year = Integer.parseInt(yearString);
              printMonth(year, month);
              if (month > 12) {
              System.out.println("Invalid Number Please Try");
         //code to perform OK action
              /** Print the calendar for a month in a year */
              static void printMonth(int year, int month) {
                   //Print the heading of the calendar
                   printMonthTitle(year, month);
                   //Print the headings of the calendar
                   printMonthBody(year, month);
              /** Print the month title, e.g., May, 1999 */
              static void printMonthTitle(int year, int month) {
                   System.out.println(" " + getMonthName(month)
                   + " " + year);
                   System.out.println("------------------------------");
                   System.out.println(" Sun Mon Tue Wed Thu Fri Sat");
                   /** Get the English name for the month */
                   static String getMonthName(int month) {
                        String monthName = null;
                        switch (month) {
                             case 1: monthName = "January"; break;
                             case 2: monthName = "February"; break;
                             case 3: monthName = "March"; break;
                             case 4: monthName = "April"; break;
                             case 5: monthName = "May"; break;
                             case 6: monthName = "June"; break;
                             case 7: monthName = "July"; break;
                             case 8: monthName = "August"; break;
                             case 9: monthName = "September"; break;
                             case 10: monthName = "October"; break;
                             case 11: monthName = "November"; break;
                             case 12: monthName = "December"; break;
                        return monthName;
    /** Print month body*/
    static void printMonthBody(int year, int month){
    //Get start day of the week for the first date in the month
    int startDay = getStartDay(year, month);
    //Get number of days in the month
    int numberOfDaysInMonth = getNumberOfDaysInMonth(year, month);
    //Pad space before the first day of the month
    int i = 0;
    for (i = 0; i < startDay; i++)
         System.out.print(" ");
    for (i = 1; i <= numberOfDaysInMonth; i++) {
    if (i < 10)
    System.out.print(" " + i);
    else
    System.out.print(" " + i);
    if ((i + startDay) % 7 == 0)
         System.out.println();
         System.out.println();
    /** Get the start day of the first day in a month */
    static int getStartDay(int year, int month) {
    //Get total number of days since 1/1/1800
    int startDay1800 = 3;
    int totalNumberOfDays = getTotalNumberOfDays(year, month);
    //Return the start day
    return (totalNumberOfDays + startDay1800) % 7;
    /** Get the total number of days since Jan 1, 1800 */
    static int getTotalNumberOfDays(int year, int month) {
    int total = 0;
    // Get the total days from 1800 to year - 1
    for (int i = 1800; i < year; i++)
    if (isLeapYear(i))
    total = total + 366;
    else
    total = total + 365;
    // Add days from Jan to the month prior to the calendar month
    for (int i = 1; i < month; i++)
    total = total + getNumberOfDaysInMonth(year, i);
    return total;
    /** Get the number of days in a month */
    static int getNumberOfDaysInMonth(int year, int month) {
    if (month == 1 || month == 3 || month == 5 || month == 7 ||
    month == 8 || month == 10 || month == 12)
    return 31;
    if (month == 4 || month == 6 || month == 9 || month == 11)
    return 30;
    if (month == 2) return isLeapYear(year) ? 29 : 28;
    return 0; // If month is incorrect
    thanks
    /** Determine if it is a leap year */
    static boolean isLeapYear(int year) {
    return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
    }

    hey smallsouljah , to use code tags just put your code inside code tags.
    to create code tags you just need to press the button code that is located bellow the subject, this will automatically create code tags.
    System.out.println("testing");
    try yourself.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Numerical Command-Line Arguments in Java

    Hi I am new to Java and am a little confused about setting up command-line arguments. From what I have read, the arguments are put in the args array of the main method.
    So accessing or using them would use args[n] right?
    But the args is a string array (String[] args). Therefore what would I need to do if I wanted to treat the arguments as numbers and not strings? E.g. I wanted to apply mathematical functions to the arguments.
    I believe to do this I would need a Integer.parseInt( string ).
    This is what I have tried:
    public static void main(String[] args) {
              int firstArg = Integer.parseInt(args[1]);
              System.out.println(firstArg);
    where argument 1 is "23".
    This compiles but I get a Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
         at the "int firstArg = Integer.parseInt(args[1]);" line.
    Can someone tell me what I am doing wrong and a small over view on command line arguments would also be welcome :D.
    Thanks

    Oh yeah.. I need to tattoo args[0] to my forehead. Thanks its now working.
    Edited by: Sunny_B on Apr 20, 2008 1:21 PM

  • Protecting command-line arguments from glob expansion

    Hi. I am writing a java program and I want to pass it a regular expression as a command-line argument. However, when I use certain regular expressions (e.g. [a-z]*), the java command-line interpreter recognizes this a glob expression and replaces it with names of files from the current directory.
    I am running the java interpreter from a Linux bash command line and I am enclosing the regular expression in single quotes (e.g. '[a-z]*') to protect it from the bash interpreter but the java interpreter is still getting to it. I have read other posts which stated that the java interpreter doesn't do this and that it must be the operating system's command-line interpreter that is doing it but I am sure this not the case.
    Can anyone help? Thank you. Eli

    I am running the java interpreter from a Linux bash
    command line and I am enclosing the regular
    expression in single quotes (e.g. '[a-z]*') to
    protect it from the bash interpreter but the java
    interpreter is still getting to it. I have read other
    posts which stated that the java interpreter doesn't
    do this and that it must be the operating system's
    command-line interpreter that is doing it but I am
    sure this not the case.It most certainly is the case that it's the shell, not Java. If the VM receives the String [a-z]* then that will be one the args.
    What may be happening is that java is actually a shell script, not an executable, and that shell script is expanding stuff.
    Do this: $ type java You'll get something like java is /usr/local/bin/java Then do $ file /usr/local/bin/java or whatever comes back. (Or just try to view the file with a text editor.)
    That file might be a shell script that sets some env vars and than calls the real java executable, passing it "$*" or "$@".
    If that's the case, you can try just invoking the executable directly, or modifying that shell script so that it won't do the expansion.
    If that's not the case, then post the exact command you're running and show your main method (includig code in the main that prints out each element of the args parameter).

Maybe you are looking for

  • How to hide fields in table view

    Hi, I'm populating the contents of an internal table in a table view. I want to know how to hide few fields in table view. I'm working on classical BSPs.. no MVC and I have not used iterator. Thank you Sreesanth.

  • Changes in RFC Structure.

    Hi Experts, My RFC structure is changed, can i do anything else than restarting the server. Regards Upendra.

  • Got skype #, can't get into skype manager to set c...

    logged in to skype manager, but it requires a company name etc.?? this is just personal stuff.  any way to get around this other than to 'fake' info?

  • L&F taskbar icon

    Hi I want to change the icon thats is visible on windows taskbar, next to the application name. I have a custom L&F, but I dont know what to overide to get the preffered result. Today the java coofe cup icon is present, the same icon that comes with

  • Fonts Not Saved in Menu

    I can add fonts to the menu in Contribute CS4, but when I quit the program and re-open, the fonts I've added aren't there. How do I get the program to remember the fonts I add?