hi all i am use tomcat 8 and my war file initially i want write a file a .properties file, here the code:
Boolean wflag = false;
String wnomfile="my.properties"
Properties prop = new Properties();
OutputStream output = null;
System.out.println("Inicio Archivo Properties.. " + wnomfile);
try {
// output = new FileOutputStream("config.properties");
output = new FileOutputStream(wnomfile);
System.out.println("Archivo Creado Properties..");
// set the properties value
prop.setProperty("database", "localhost");
prop.setProperty("dbuser", "mkyong");
prop.setProperty("dbpassword", "password");
// save properties to project root folder
prop.store(output, null);
System.out.println("Archivo Creado/Grabado Properties..");
wflag = true;
} catch (IOException io) {
System.out.println("Error Archivo Properties Exception..");
io.printStackTrace();
} finally {
System.out.println("Archivo Properties inicio Finally..");
if (output != null) {
try {
System.out.println("Archivo Properties Antes de CLOSE Finally..");
output.close();
System.out.println("Archivo Properties Grabado Finally..");
} catch (IOException e) {
System.out.println("Archivo Properties Exception-Finally..");
e.printStackTrace();
}
}
}
return wflag;
my question is, in wich path have been created the file my.properties?
note my tomcat was installed following this steps:
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-14-04
and was intalled on /opt/tomcat
when i run the code the files wasnt created, how to know why?
and
if created how to know in wich path was created?
Note: also i installed glassfish on my linux ubuntu 14.04 and immediatly created the file on:
/opt/glassfish4/glassfish/domains/swManzana/config/my.properties
of course the glassfish is installed on this path:
/opt/glassfish4
and of course created the file
why in tomcat not create the file?
tomcat is been installe dnd tested.
no problems of access the webpage, and no problem with port access i am sure.
any advice?
thanks
1 Answer(s)