在命令行中将环境变量传递给Java类 [英] passing environment variable to a java class in command line
本文介绍了在命令行中将环境变量传递给Java类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有必要从本地 etc/myconfig-config/
文件夹中的文件读取某些属性.我需要在命令行中提供此文件路径.我给了它如下所述.但是有一个错误,它显示为
I have a necessity to read some properties from a file located in local etc/myconfig-config/
folder. I need to give this file path in the command line. I have given it as mentioned below. But there is an error and it displays like
Error: Could not find or load main class test-tool.jar.
给出的命令是
java -cp -DconfigDir=/etc/myconfig-config/ test-tool.jar
service.ScriptGenerator $clinic_count $client_files_count
有人可以帮我解决这个问题吗?
can anybody please help me to resolve this.
谢谢
推荐答案
尝试给出以下命令,
java -DconfigDir=/etc/myconfig-config/ -cp test-tool.jar service.ScriptGenerator $clinic_count $client_files_count
这篇关于在命令行中将环境变量传递给Java类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文