properties-file

How to load java properties file and use in Spark?

北战南征 提交于 2019-11-27 12:16:15
问题 I want to store the Spark arguments such as input file, output file into a Java property files and pass that file into Spark Driver. I'm using spark-submit for submitting the job but couldn't find a parameter to pass the properties file. Have you got any suggestions? 回答1: here i found one solution: props file : (mypropsfile.conf) // note: prefix your key with "spark." else props will be ignored. spark.myapp.input /input/path spark.myapp.output /output/path launch $SPARK_HOME/bin/spark-submit

Need bash shell script for reading name value pairs from a file

为君一笑 提交于 2019-11-27 05:04:00
I have a file like name1=value1 name2=value2 I need to read this file using shell script and set variables $name1=value1 $name2=value2 Please provide a script that can do this. I tried the first answer below, i.e. sourcing the properties file but I'm getting a problem if the value contains spaces. It gets interpreted as a new command after the space. How can I get it to work in the presence of spaces? kurumi Use: while read -r line; do declare "$line"; done <file If all lines in the input file are of this format, then simply sourcing it will set the variables: source

Get values from properties file using Groovy

强颜欢笑 提交于 2019-11-27 03:49:37
How to get values from properties file using Groovy? I require to have a property file (.properties) which would have file names as key, and their destination path as the value. I will need the key to be resolved at runtime, depending on file that needs to be moved. So far I am able to load the properties it seems but can't "get" the value from the loaded properties. I referred to the thread : groovy: How to access to properties file? and following is the code snippet i have so far def props = new Properties(); File propFile = new File('D:/XX/XX_Batch/XX_BATCH_COMMON/src/main/resources

How to read a properties file in javascript from project directory?

大城市里の小女人 提交于 2019-11-27 01:57:49
问题 I'm building a Chrome Packaged App. I want to put the script configuration if a config file in a resource directory and on startup want to read that by Javascript. For example Project WebContent index.html manifest.json main.js resource config.properties Here I want main.js to load config.properties file in the beginning and get key-value pairs. Have anyone done something like this? 回答1: There is a super simple way to do this, along the lines of sowbug's answer, but which doesn't need any XHR

How to share common properties among several maven projects?

孤街醉人 提交于 2019-11-26 19:48:51
I have several projects built by maven, and I want to share some common properties among them - spring version, mysql driver version, svn base url, etc. - so I can update them once and it will be reflected on all projects. I thought of having a single super pom with all the properties, but if I change one of the problem I need to either increment its version (and to update all the poms inherit from it) or to delete it from all the developers' machines which I don't want to do. Can specify these parameters externally to the pom? I still want to have the external location definition in a parent

Accessing properties file in a JSF application programmatically

对着背影说爱祢 提交于 2019-11-26 16:09:22
问题 I am trying to access the i18n properties file I'm using in my JSF application in code. (The idea is to have a page that displays its keys and values as a table actually.) The project is a maven project, and in the src/resources/localization folder, and deployed in the war file in WEB-INF\classes\localization\ java.util.Properties prop = new java.util.Properties(); String path = "localization/stat_codes.properties"; InputStream foo = prop.getClass().getResourceAsStream(path); But the variable

Reading properties file from Maven POM file

别等时光非礼了梦想. 提交于 2019-11-26 15:58:37
问题 I have Maven POM file with some configuration and in the section plugins, I have maven tomcat plugin with some configuration like this: <configuration> <url>http://localhost:8080/manager/html</url> <server>tomcat</server> </configuration> I'd like to export url setting to some property file for example tomcat.properties with that key: url=http://localhost:8080/manager/html And how can I read this key back in my POM file? 回答1: Maven allows you to define properties in the project's POM. You can

Need bash shell script for reading name value pairs from a file

浪尽此生 提交于 2019-11-26 12:46:33
问题 I have a file like name1=value1 name2=value2 I need to read this file using shell script and set variables $name1=value1 $name2=value2 Please provide a script that can do this. I tried the first answer below, i.e. sourcing the properties file but I\'m getting a problem if the value contains spaces. It gets interpreted as a new command after the space. How can I get it to work in the presence of spaces? 回答1: Use: while read -r line; do declare "$line"; done <file 回答2: If all lines in the input

Get values from properties file using Groovy

老子叫甜甜 提交于 2019-11-26 12:25:16
问题 How to get values from properties file using Groovy? I require to have a property file (.properties) which would have file names as key, and their destination path as the value. I will need the key to be resolved at runtime, depending on file that needs to be moved. So far I am able to load the properties it seems but can\'t \"get\" the value from the loaded properties. I referred to the thread : groovy: How to access to properties file? and following is the code snippet i have so far def

How to share common properties among several maven projects?

怎甘沉沦 提交于 2019-11-26 07:27:21
问题 I have several projects built by maven, and I want to share some common properties among them - spring version, mysql driver version, svn base url, etc. - so I can update them once and it will be reflected on all projects. I thought of having a single super pom with all the properties, but if I change one of the problem I need to either increment its version (and to update all the poms inherit from it) or to delete it from all the developers\' machines which I don\'t want to do. Can specify