This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Siegfried Heintze
Ranch Hand
Posts: 403
  • 0
  • 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
 
Campbell Ritchie
Sheriff
Pie
Posts: 47261
52
  • 0
  • 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: 403
  • 0
  • 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.
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • 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: 403
 
Rob Spoor
Sheriff
Pie
Posts: 20380
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing that!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic