small medium large xlarge

Back to: All Forums  Modular Java
28 Sep 2015, 11:33
Manoj Rawat (5 posts)

I want to write file. My query is that “In which path should it be created”. I have installed glassfish on my Linux 14.04 machine on this path: /opt/glassfish4 and created the file at: /opt/glassfish4/glassfish/domains/swManzana/config/

This is my Code: Boolean wflag = false; String wnomfile=”” Properties prop = new Properties(); OutputStream output = null; System.out.println(“Inicio Archivo Properties.. “ + wnomfile); try { // output = new FileOutputStream(“”); 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,null); System.out.println(“Archivo Creado/Grabado Properties..”); wflag=true; }catch(IOExceptionio){ 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(IOExceptione){ System.out.println(“Archivo Properties Exception-Finally..”); e.printStackTrace(); } } } returnwflag;

While executing the above code file not created. Why Tomcat is not creating this file. I have properly checked my tomcat installation and found no issues in access web Pages and ports. Can anyone suggest me some knowledgeable tutorials URL Links on Java questions and answers, so that I can get my query resolved faster.

You must be logged in to comment