[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2304
  • Last Modified:

pass arguments to an executable Jar file

Hi:

I have a program that accepts 0 or one argument. I know how to prepare manifest file, export the program to be an excutable jar file, and execute it on command line without taking any argument. But how do I do the same where I do need to pass an arguement?

Thanks.
0
sdc248
Asked:
sdc248
  • 2
  • 2
1 Solution
 
objectsCommented:

java -jar my.jar arg1 arg2
0
 
gauravkrtomarCommented:
if u want to pass any arguments u can simply pass them in the command-line as given below:-

java -jar XYZ.jar abc def

where XYZ.jar is the name of the jar file and abc & def are the arguments (u can pass any number of arguments u want)
0
 
sdc248Author Commented:
Thanks guys. But how do I pass the argument dynamically? I am using a batch file that contains the command and the batch is scheduled to run daily with parameter of yesterday's date. I guess that means I need to add commands that get today's datetime, roll back one day, and use the result as my argument. Unfortunately I am not so familiar with DOS commands. I know this is a bit out of the scope but could you guys help?
0
 
gauravkrtomarCommented:
0
 
sdc248Author Commented:
I've found a work around that doesn't need to do those scriptings. (Good for me!) Thanks.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now