Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to wrap java programs in cmd.exe and bash?

 
Ranch Hand
Posts: 420
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a groovy program that needs to know the number of args:



Here is the bat file I use to call it and it is not working.


Here is the bash file I use to call it and it is not working.


The problem is that args.size() always returns the same value regardless of how many arguments I pass to main. The solution is to manually set up the class path each time and abandon the bat and bash scripts.

Is there a way to write my bash and bat files so they are sensitive to the number of arguments? I am posting this here in the java forum because I don't believe this problem is specific to groovy.

Thanks,
Siegfried
 
Marshal
Posts: 69884
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know, but this is too difficult for "beginning", so I shall move this thread.
 
Siegfried Heintze
Ranch Hand
Posts: 420
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow! No reply in a while. Does this mean it is not possible? I'm going to try cross posting in www.unix.com concerning bash. I'm not sure where to solicit help with cmd.exe.
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.cmd file:$* may work in Unix but I'm not really sure.
 
Siegfried Heintze
Ranch Hand
Posts: 420
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing that!
 
    Bookmark Topic Watch Topic
  • New Topic