• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

interpretation of command line parameter  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

Look at this tiny little class:



Invocation with the following parameters:

one two three

will generate the output:

argument0ne
argument1:two
argument2:three

Nothing special so far.

Now I change the parameters to:

one *.xml three

The working directory contains two xml-files: abc.xml and xyz.xml

The output is:
argument0ne
argument1:abc.xml
argument2:xyz.xml
argument3:three

Wow! The java-command automatically expands filenames containing wildcards!
Nice feature....but I want the output look like this:

argument0ne
argument1:*.xml
argument2:three

Any ideas ?

Jens
[ April 21, 2008: Message edited by: Jens M Mayer ]
 
Rancher
Posts: 42973
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not Java doing this, it's the shell you're typing this in. I think surrounding the parameters with double quotes (like "*.xml") will prevent it from happening. The specifics may depend on the shell, though.
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wrap *.xml in quotes, like java test one "*.xml" three
 
Ulf Dittmer
Rancher
Posts: 42973
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

wrap *.xml in quotes, like java test one "*.xml" three


Isn't that precisely what I suggested?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!