Thanks for the reply Henry,Could please give me the example.Henry Wong wrote:
Bash (actually, *all* of the shells) allows you to set a script variable to the output of a program -- via usage of the single back quote.
So, you program can simply print the result to standard output. And exit, of course, as Bash needs to get control back to finish the assignment...
Henry
Thanks for the reply Stephan,But its not working in my scenario.Stephan van Hulst wrote:Don't do this from Java. Use your shell's capabilities. In Bash, you can try this:
Henry Wong wrote:
Both the usage of backquotes, and the usage of $() should work. If it doesn't, or seems to not work, you need to provide more details. This is a debugging situation... and we can't help you debug with no visibility.
Henry
Same result for output stream aswellStephan van Hulst wrote:Your application doesn't print anything to standard output. You're using the error stream.
Stephan van Hulst wrote:Again, show us the output of just calling your java command.
Stephan van Hulst wrote:You shouldn't post an image. Copy the output from your terminal.
Stephan van Hulst wrote:Is MY_VAR visible in the output when you run the following?
Stephan van Hulst wrote:That's not the command I posted. set is a separate command on a separate line.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Henry ,You are correct that is windows shell(cmd) and I need to write the batch file(.bat) for the same requirements mentioned above.Could you please help me on this?Henry Wong wrote:
Are you running the bash command shell? It looks like the windows shell to me.
Henry
Ravi kapa wrote:Henry ,You are correct that is windows shell(cmd) and I need to write the batch file(.bat) for the same requirements mentioned above.Could you please help me on this?
Stephan van Hulst wrote:The solution is the same as for Bash. Just google how to set environment variables from CMD.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |