maven - How to go back one directory from working directory in Java? -


i'm using code in order read file content in maven module. file stored in 1 directory working directory.

string configfilepath = system.getproperty("user.dir") + "../conf/gce-configuration.xml";  file configfile = new file(configfilepath); 

then when try read file gives me file not found error.

file cannot found : /home/xxxx/bin../conf/gce-configuration.xml

i tried different ways still i'm getting error. i'm doing wrong here?

edit: seems forgot mention file name in assembly/bin.xml in maven module. xml file not include package. bad!

as want go 1 level above current dir can by

 string configfilepath = new file(system.getproperty("user.dir")).getparent() + "/conf/gce-configuration.xml"; 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -