If "java -jar" is run from a command line, is there a way to set local dos variable from java program so that after java is exited, it can still be present in the same session?
example
(cmd)
c:\java package.Class
/*then in program you do something like
'System.setVariable("name","value");'
*/
// java exited
echo %name%
value
No. Processes cannot modify their parents' environment.
The best thing you can do is cheat a little and do either of the following:
cmd
process they can alter environment variables there.set
commands, catch the output and set the variables yourself afterwards. Goes wrong as soon as you want or have other output, I guess.