我有一个JAR
,它接受环境变量选项。通过设置运行配置手动运行主类时,我提供的环境变量为:KERBOROS_KEYTAB_LOC="location of the keytab file"
现在,我需要在运行JAR
时设置这些选项。我该如何设置?我尝试了以下选项,但无法正常工作。
java -DKERBOROS_KEYTAB_LOC="location of the keytab file" -jar jarfile.jar
答案 0 :(得分:1)
在linux上,执行
$ export KERBOROS_KEYTAB_LOC="location of the keytab file"
在Windows上
C:\>SomeDir>set KERBOROS_KEYTAB_LOC="location of the keytab file"
然后像往常一样运行jar
答案 1 :(得分:-1)
通常,在运行jar文件时,您可以像下面那样传递环境变量。
示例:
java -Djava.security.auth.login.config =“ / path / kafkalogin.config” -jar myApplication.jar