fix bug: server.ip not found
This commit is contained in:
parent
a2109eb2f6
commit
ab29f7ac06
|
@ -74,7 +74,8 @@
|
|||
"properties":{
|
||||
"csvSavePath":"hdfs://10.0.86.89:9000/xjzhu/phdthesis_result.csv",
|
||||
"header":"true",
|
||||
"delimiter":","
|
||||
"delimiter":",",
|
||||
"partition": "1"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -59,7 +59,8 @@
|
|||
"properties":{
|
||||
"csvSavePath":"hdfs://10.0.86.191:9000/xjzhu/phdthesis_result.csv",
|
||||
"header":"true",
|
||||
"delimiter":","
|
||||
"delimiter":",",
|
||||
"partition": "1"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -12,6 +12,11 @@ object FileUtil {
|
|||
|
||||
|
||||
def writeFile(text: String, path: String) = {
|
||||
|
||||
val file = new File(path)
|
||||
if(!file.exists()){
|
||||
file.createNewFile()
|
||||
}
|
||||
val writer = new PrintWriter(new File(path))
|
||||
writer.write(text)
|
||||
writer.close()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package cn.piflow.util
|
||||
|
||||
import java.io.{FileInputStream, InputStream}
|
||||
import java.io.{File, FileInputStream, InputStream}
|
||||
import java.net.InetAddress
|
||||
import java.util.Properties
|
||||
|
||||
|
@ -13,6 +13,10 @@ object ServerIpUtil {
|
|||
|
||||
val userDir = System.getProperty("user.dir")
|
||||
path = userDir + "/server.ip"
|
||||
val file = new File(path)
|
||||
if(!file.exists()){
|
||||
file.createNewFile()
|
||||
}
|
||||
prop.load(new FileInputStream(path))
|
||||
} catch{
|
||||
case ex: Exception => ex.printStackTrace()
|
||||
|
|
Loading…
Reference in New Issue