Java expands wildcards in command line arguments in Windows: documentation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bharath Dhurjati

    Java expands wildcards in command line arguments in Windows: documentation

    Hello,

    I am looking for documentation that specifies the following behavior
    exhibited by java.

    The following (assuming MyClass.class is accessible and has a main())

    java MyClass *

    yields the same result on Windows as on Unix, inspite of Windows not
    expanding shell wildcards. Basically, the args[] passed to main()
    contains names of files in that directory.

    The basic behavior is documented in the following link:


    The last post by Kevin Kelley points this as 'specified' behavior for
    java.exe.

    The following link also points this as specified behavior.


    Now I am trying to find out exactly WHERE is this specified.
    I have run searches on java.sun.com and used their documentation
    searcher also, but couldn't find any documentation.

    Can some one please help?

    Thanks.

    Regards,
    Bharath.
  • mhandis

    #2
    Re: Java expands wildcards in command line arguments in Windows:documen tation

    Your statement: "inspite of Windows not expanding shell wildcards" is
    not true. Windows does expand the wildcard, just like bash or csh (unix)
    does.

    If you want to see what is actually being passed in, echo it:
    echo java MyClass *

    Echo works on both Windows and unix as well.

    So this has nothing to do with Java at all.

    Bharath Dhurjati wrote:[color=blue]
    > Hello,
    >
    > I am looking for documentation that specifies the following behavior
    > exhibited by java.
    >
    > The following (assuming MyClass.class is accessible and has a main())
    >
    > java MyClass *
    >
    > yields the same result on Windows as on Unix, inspite of Windows not
    > expanding shell wildcards. Basically, the args[] passed to main()
    > contains names of files in that directory.
    >
    > The basic behavior is documented in the following link:
    > http://groups.google.com/groups?hl=e...argate.sgi.net
    >
    > The last post by Kevin Kelley points this as 'specified' behavior for
    > java.exe.
    >
    > The following link also points this as specified behavior.
    > http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
    >
    > Now I am trying to find out exactly WHERE is this specified.
    > I have run searches on java.sun.com and used their documentation
    > searcher also, but couldn't find any documentation.
    >
    > Can some one please help?
    >
    > Thanks.
    >
    > Regards,
    > Bharath.[/color]

    Comment

    • CD Rasmussen

      #3
      Re: Java expands wildcards in command line arguments in Windows:documen tation

      Not under XP Pro.
      echo *
      prints "*"
      Wild card expansion has never been a function of batch but is done by
      whatever is run under batch, see the "for" command in batch for this.

      Constantine

      mhandis wrote:[color=blue]
      > Your statement: "inspite of Windows not expanding shell wildcards" is
      > not true. Windows does expand the wildcard, just like bash or csh (unix)
      > does.
      >
      > If you want to see what is actually being passed in, echo it:
      > echo java MyClass *
      >
      > Echo works on both Windows and unix as well.
      >
      > So this has nothing to do with Java at all.
      >
      > Bharath Dhurjati wrote:
      >[color=green]
      >> Hello,
      >>
      >> I am looking for documentation that specifies the following behavior
      >> exhibited by java.
      >>
      >> The following (assuming MyClass.class is accessible and has a main())
      >>
      >> java MyClass *
      >>
      >> yields the same result on Windows as on Unix, inspite of Windows not
      >> expanding shell wildcards. Basically, the args[] passed to main()
      >> contains names of files in that directory.
      >>
      >> The basic behavior is documented in the following link:
      >> http://groups.google.com/groups?hl=e...argate.sgi.net
      >>
      >>
      >> The last post by Kevin Kelley points this as 'specified' behavior for
      >> java.exe.
      >>
      >> The following link also points this as specified behavior.
      >> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
      >>
      >> Now I am trying to find out exactly WHERE is this specified.
      >> I have run searches on java.sun.com and used their documentation
      >> searcher also, but couldn't find any documentation.
      >>
      >> Can some one please help?
      >>
      >> Thanks.
      >>
      >> Regards,
      >> Bharath.[/color][/color]

      Comment

      • CD Rasmussen

        #4
        Re: Java expands wildcards in command line arguments in Windows:documen tation

        Not under XP Pro.
        echo *
        prints "*"
        Wild card expansion has never been a function of batch but is done by
        whatever is run under batch, see the "for" command in batch for this.

        Constantine

        mhandis wrote:[color=blue]
        > Your statement: "inspite of Windows not expanding shell wildcards" is
        > not true. Windows does expand the wildcard, just like bash or csh (unix)
        > does.
        >
        > If you want to see what is actually being passed in, echo it:
        > echo java MyClass *
        >
        > Echo works on both Windows and unix as well.
        >
        > So this has nothing to do with Java at all.
        >
        > Bharath Dhurjati wrote:
        >[color=green]
        >> Hello,
        >>
        >> I am looking for documentation that specifies the following behavior
        >> exhibited by java.
        >>
        >> The following (assuming MyClass.class is accessible and has a main())
        >>
        >> java MyClass *
        >>
        >> yields the same result on Windows as on Unix, inspite of Windows not
        >> expanding shell wildcards. Basically, the args[] passed to main()
        >> contains names of files in that directory.
        >>
        >> The basic behavior is documented in the following link:
        >> http://groups.google.com/groups?hl=e...argate.sgi.net
        >>
        >>
        >> The last post by Kevin Kelley points this as 'specified' behavior for
        >> java.exe.
        >>
        >> The following link also points this as specified behavior.
        >> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
        >>
        >> Now I am trying to find out exactly WHERE is this specified.
        >> I have run searches on java.sun.com and used their documentation
        >> searcher also, but couldn't find any documentation.
        >>
        >> Can some one please help?
        >>
        >> Thanks.
        >>
        >> Regards,
        >> Bharath.[/color][/color]

        Comment

        • nos

          #5
          Re: Java expands wildcards in command line arguments in Windows: documentation

          yes, there is no expansion under XP pro (just tried it too)

          I don't have access to win 95 now, but years ago with turbo c++
          there was no expansion either and Borland provided an
          object file that you could link in to do the expansion prior
          to invoking the program

          "CD Rasmussen" <Constantine.Ra smussen@comcast .net> wrote in message
          news:At6dnTkXE4 PWcFCiRVn-vg@comcast.com. ..[color=blue]
          > Not under XP Pro.
          > echo *
          > prints "*"
          > Wild card expansion has never been a function of batch but is done by
          > whatever is run under batch, see the "for" command in batch for this.
          >
          > Constantine
          >
          > mhandis wrote:[color=green]
          > > Your statement: "inspite of Windows not expanding shell wildcards" is
          > > not true. Windows does expand the wildcard, just like bash or csh (unix)
          > > does.
          > >
          > > If you want to see what is actually being passed in, echo it:
          > > echo java MyClass *
          > >
          > > Echo works on both Windows and unix as well.
          > >
          > > So this has nothing to do with Java at all.
          > >
          > > Bharath Dhurjati wrote:
          > >[color=darkred]
          > >> Hello,
          > >>
          > >> I am looking for documentation that specifies the following behavior
          > >> exhibited by java.
          > >>
          > >> The following (assuming MyClass.class is accessible and has a main())
          > >>
          > >> java MyClass *
          > >>
          > >> yields the same result on Windows as on Unix, inspite of Windows not
          > >> expanding shell wildcards. Basically, the args[] passed to main()
          > >> contains names of files in that directory.
          > >>
          > >> The basic behavior is documented in the following link:
          > >>[/color][/color][/color]

          3f09e2bd3e85a8e &seekm=01be589d %24dc827700%24b aac72d1%40starg ate.sgi.net[color=blue][color=green][color=darkred]
          > >>
          > >>
          > >> The last post by Kevin Kelley points this as 'specified' behavior for
          > >> java.exe.
          > >>
          > >> The following link also points this as specified behavior.
          > >> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
          > >>
          > >> Now I am trying to find out exactly WHERE is this specified.
          > >> I have run searches on java.sun.com and used their documentation
          > >> searcher also, but couldn't find any documentation.
          > >>
          > >> Can some one please help?
          > >>
          > >> Thanks.
          > >>
          > >> Regards,
          > >> Bharath.[/color][/color]
          >[/color]


          Comment

          • nos

            #6
            Re: Java expands wildcards in command line arguments in Windows: documentation

            yes, there is no expansion under XP pro (just tried it too)

            I don't have access to win 95 now, but years ago with turbo c++
            there was no expansion either and Borland provided an
            object file that you could link in to do the expansion prior
            to invoking the program

            "CD Rasmussen" <Constantine.Ra smussen@comcast .net> wrote in message
            news:At6dnTkXE4 PWcFCiRVn-vg@comcast.com. ..[color=blue]
            > Not under XP Pro.
            > echo *
            > prints "*"
            > Wild card expansion has never been a function of batch but is done by
            > whatever is run under batch, see the "for" command in batch for this.
            >
            > Constantine
            >
            > mhandis wrote:[color=green]
            > > Your statement: "inspite of Windows not expanding shell wildcards" is
            > > not true. Windows does expand the wildcard, just like bash or csh (unix)
            > > does.
            > >
            > > If you want to see what is actually being passed in, echo it:
            > > echo java MyClass *
            > >
            > > Echo works on both Windows and unix as well.
            > >
            > > So this has nothing to do with Java at all.
            > >
            > > Bharath Dhurjati wrote:
            > >[color=darkred]
            > >> Hello,
            > >>
            > >> I am looking for documentation that specifies the following behavior
            > >> exhibited by java.
            > >>
            > >> The following (assuming MyClass.class is accessible and has a main())
            > >>
            > >> java MyClass *
            > >>
            > >> yields the same result on Windows as on Unix, inspite of Windows not
            > >> expanding shell wildcards. Basically, the args[] passed to main()
            > >> contains names of files in that directory.
            > >>
            > >> The basic behavior is documented in the following link:
            > >>[/color][/color][/color]

            3f09e2bd3e85a8e &seekm=01be589d %24dc827700%24b aac72d1%40starg ate.sgi.net[color=blue][color=green][color=darkred]
            > >>
            > >>
            > >> The last post by Kevin Kelley points this as 'specified' behavior for
            > >> java.exe.
            > >>
            > >> The following link also points this as specified behavior.
            > >> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
            > >>
            > >> Now I am trying to find out exactly WHERE is this specified.
            > >> I have run searches on java.sun.com and used their documentation
            > >> searcher also, but couldn't find any documentation.
            > >>
            > >> Can some one please help?
            > >>
            > >> Thanks.
            > >>
            > >> Regards,
            > >> Bharath.[/color][/color]
            >[/color]


            Comment

            • mhandis

              #7
              Re: Java expands wildcards in command line arguments in Windows:documen tation

              You are right, it doesn't work under windows with echo, only under
              unix/linux.

              The following C program demonstrates that Windows does expand *:

              #include<stdio. h>
              int main(int argc, char **argv) {
              int i;
              for(i = 0; i < argc; i++) {
              printf("arg %d = %s\n", i+1, argv[i]);
              }
              return 0;
              }


              As does the following Java program:

              public class Test {
              public static void main(String[] args) {
              for(int i = 0; i < args.length; i++) {
              System.out.prin tln("arg " + (i+1) + " = " + args[i]);
              }
              }
              }


              CD Rasmussen wrote:[color=blue]
              > Not under XP Pro.
              > echo *
              > prints "*"
              > Wild card expansion has never been a function of batch but is done by
              > whatever is run under batch, see the "for" command in batch for this.
              >
              > Constantine
              >
              > mhandis wrote:
              >[color=green]
              >> Your statement: "inspite of Windows not expanding shell wildcards" is
              >> not true. Windows does expand the wildcard, just like bash or csh
              >> (unix) does.
              >>
              >> If you want to see what is actually being passed in, echo it:
              >> echo java MyClass *
              >>
              >> Echo works on both Windows and unix as well.
              >>
              >> So this has nothing to do with Java at all.
              >>
              >> Bharath Dhurjati wrote:
              >>[color=darkred]
              >>> Hello,
              >>>
              >>> I am looking for documentation that specifies the following behavior
              >>> exhibited by java.
              >>>
              >>> The following (assuming MyClass.class is accessible and has a main())
              >>>
              >>> java MyClass *
              >>>
              >>> yields the same result on Windows as on Unix, inspite of Windows not
              >>> expanding shell wildcards. Basically, the args[] passed to main()
              >>> contains names of files in that directory.
              >>>
              >>> The basic behavior is documented in the following link:
              >>> http://groups.google.com/groups?hl=e...argate.sgi.net
              >>>
              >>>
              >>> The last post by Kevin Kelley points this as 'specified' behavior for
              >>> java.exe.
              >>>
              >>> The following link also points this as specified behavior.
              >>> http://www.cse.fau.edu/~roy/cop4331/asgmt1.html#jdk1.2
              >>>
              >>> Now I am trying to find out exactly WHERE is this specified.
              >>> I have run searches on java.sun.com and used their documentation
              >>> searcher also, but couldn't find any documentation.
              >>>
              >>> Can some one please help?
              >>>
              >>> Thanks.
              >>>
              >>> Regards,
              >>> Bharath.[/color][/color]
              >
              >[/color]

              Comment

              Working...