thuliobuarque / java2word

Automatically exported from code.google.com/p/java2word
0 stars 0 forks source link

Error using the templates #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What web framework and version are you using (Struts1, Struts2, Spring,
JBoss Seam)?
A simple java class

Did you download j2w-ejb-2.0.zip or built from the source code?
I download the las version of java2doc

Which web server did you deploy your .WAR (Tomcat, JBoss)?
I don´t use any server

Are you using Maven or Ant?
not

What is your Operational System?
Windows xp

What steps will reproduce the problem?
1.I download your document ReleaseNotesTemplate.doc
2.I run the class with the code of internet(test_template) for templates
3.It gives me then next error:
java.io.FileNotFoundException: build.properties (El sistema no puede hallar el 
archivo especificado)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at word.utils.TestUtils.createLocalDocument(TestUtils.java:45)
    at word.utils.TestUtils.createLocalDoc(TestUtils.java:37)
    at Cliente.testTemplate(Cliente.java:50)
    at Cliente.main(Cliente.java:75)
java.io.FileNotFoundException: null\C:\Proyecto\Plantilla3.doc (El nombre de 
archivo, directorio o etiqueta del volumen no es válido)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.PrintWriter.<init>(Unknown Source)
    at word.utils.TestUtils.createLocalDocument(TestUtils.java:58)
    at word.utils.TestUtils.createLocalDoc(TestUtils.java:37)
    at Cliente.testTemplate(Cliente.java:50)
    at Cliente.main(Cliente.java:75)

Please provide any additional information below.

Original issue reported on code.google.com by jmo...@gmail.com on 23 Sep 2011 at 12:07

GoogleCodeExporter commented 8 years ago
what is this "null" in your path:

 null\C:\Proyecto\Plantilla3.doc

Leonardo

Original comment by leonardo...@gmail.com on 25 Sep 2011 at 8:48

GoogleCodeExporter commented 8 years ago
Finally I have found the error, the problem is in this part of your code for
createLocalDocument:

public static void createLocalDocument(String myDoc, String fileName)
{        //Property prop = new Property("");        Properties prop =
new Properties();        *String tmpDocs = "";**        try {**
    prop.load(new FileInputStream("build.properties"));**        }
catch (IOException e) {**            e.printStackTrace();**        }**
       tmpDocs = (String) prop.get("tmp.docs.dir");*
//System.out.println(tmpDocs);
//"/home/leonardo/Desktop/Java2word_allInOne.doc"        File fileObj
= new File(tmpDocs + "/" + fileName);        PrintWriter writer =
null;        try {            writer = new PrintWriter(fileObj);
 } catch (FileNotFoundException e) {            e.printStackTrace();
     }        String myWord = myDoc;        writer.println(myWord);
    writer.close();    }

The problem is the mark text, I think that it works in Unix but not in
Windows, I try deleting this part of code and it works. You only should pass
the global root to method.

Original comment by jmo...@gmail.com on 26 Sep 2011 at 3:28

GoogleCodeExporter commented 8 years ago

Original comment by leonardo...@gmail.com on 2 Feb 2012 at 12:25