One Star

[resolved] how to pass parameter values from command line [Java]

Ok, I've found the following topics/bugs that show how to do it in Perl, but how can I do it in Java?
316
634
1414
This topic shows how to add the values to the code in the .sh or .bat files, but I want to add it to the command line call for that .sh or .bat file
1616
Do I just call the file in the command window and put "--context_param parameter1=adsfakf" in the command line after the name of the .bat file?
Ex. C:\>BatchFile.bat "--context_param parameter1=adsfakf"

Also, when passing a parameter at the command line, do I need to check the Prompt checkbox for that parameter in the Contexts tab/view?
1 ACCEPTED SOLUTION

Accepted Solutions
Employee

Re: [resolved] how to pass parameter values from command line [Java]

Java generated script was designed based on Perl generated script, as far as command line option are concerned. Conclusion : do it the same way. But don't do it in the *.bat call, but on the "java" call (look inside the *.bat file).
Thanks to fnoury request in 4258, you should soon be able to give --context_param key="value" to the *.bat file.
7 REPLIES
One Star

Re: [resolved] how to pass parameter values from command line [Java]

Anyone know how to do this in Java???
One Star

Re: [resolved] how to pass parameter values from command line [Java]

Not sure, but I did some exploring on the net - perhaps this will provide a needed clue:
http://www.javaworld.com/javaworld/javaqa/1999-07/02-qa-shell.html
Employee

Re: [resolved] how to pass parameter values from command line [Java]

Java generated script was designed based on Perl generated script, as far as command line option are concerned. Conclusion : do it the same way. But don't do it in the *.bat call, but on the "java" call (look inside the *.bat file).
Thanks to fnoury request in 4258, you should soon be able to give --context_param key="value" to the *.bat file.
One Star

Re: [resolved] how to pass parameter values from command line [Java]

1615
One Star

Re: [resolved] how to pass parameter values from command line [Java]

I just posted a short tutorial on my blog about this.
How to pass parameter values from command line
Hope this help
Roberto
One Star

Re: [resolved] how to pass parameter values from command line [Java]

Employee

Re: [resolved] how to pass parameter values from command line [Java]

Sorry, the url for the tutorial is
http://www.robertomarchetto.com/www/how_to_parameter_values_talend_job_command_line

Very nice blog post. Thanks a lot!
Best,
Pcoffre.