• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

* as a parameter to main

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Run this code -

When run from command prompt as - java TestDir *,
This code simply lists all the files from current directory. How is it working?
TIA,
- Manish
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know why, but notice "dir *" works in command prompt.
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree that * works as a wildcard charactter while listing directories, but why should it work as such in Java VM?
I expected output to be - Arg 0 : *
But don't know why it is working this way.
TIA,
- Manish
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by luco zhao:
I don't know why, but notice "dir *" works in command prompt.


Nod,i think so ,too.
i think windows commond will treat * as all files in current directory,and pass them to the java process
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,
Quite novel, isn't it?
The answer is in JavaFAQ (just open your eyes widdddeeee and you'll find it ).
Ex Animo Java!
-- Val
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have a link?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was looking for the TestDir Class in www.javafaq.nu .. Didnt find it do you have a direct link ?
Thanx.
 
Sayed Ibrahim Hashimi
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the link...but it gives no explination.
http://www.javafaq.nu/java/500/index.shtml?hop=jspecialis.javafaq
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I found the link...but it gives no explination.
http://www.javafaq.nu/java/500/index.shtml?hop=jspecialis.javafaq


The above link does not tell us anything about the question we had but Alexandre Patchine, the owner of the link just want to sell us his book.
Sorry, Alexandre Patchine, This is a self help group - we help each other in Java. I may not know the answer, I will find out through other resources and I can live without knowing the answer for now.
[ May 22, 2002: Message edited by: Kasey Tritt ]
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way,
java -classpath . TestDir *.html
will print .html files in current directory:-)
this parameters also works : a*.java,abc.*a,...
I'll find the reason !!!
Jamal
www.j-think.com
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a bug.
http://developer.java.sun.com/developer/bugParade/bugs/4672990.html
Jamal Hasanov
www.j-think.com
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a bug.
http://developer.java.sun.com/developer/bugParade/bugs/4672990.html
You must use
java TestDir "*"
Jamal Hasanov
www.j-think.com
 
Kasey Tritt
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


This is a bug.
http://developer.java.sun.com/developer/bugParade/bugs/4672990.html
Jamal Hasanov
www.j-think.com


I find it interesting that people can actually try to sell something based on a bug. I mean, if I purchase the book based on the info on the link, I'll be mad to find out that the reason for the question is a bug .
Thanks Jamal for the info.
 
whippersnapper
Posts: 1843
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out this previous thread on this topic.
 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sure that soon SUN guys will close this bug by saying it is not a bug but operating system problem.
 
Val Pecaoco
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jamal Hasanov:
This is a bug.
You must use
java TestDir "*"



Mine worked fine with just java TestDir *.
My JDK is 1.3.1 on Win 98.
Ex Animo Java!
-- Val
 
Jamal Hasanov
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is JRE 1.4 or Win2000 bug. Please visit Sun's Java bug database
Jamal
 
reply
    Bookmark Topic Watch Topic
  • New Topic