Jump to content
Changes to the Jaspersoft community edition download ×

JasperCompileManager saving .java to /root


martynhiemstra

Recommended Posts

Hi All

 

I have designed my own web application that runs under tomcat. The web application runs perfectly on 1 machine but on the other machine the reports are trying to be compiled to /root.

 

I dont know what the default behavior should be but compiling a report in a home directory let alone /root is a bad idea. I haven't set the compile directory anywhere so I am assuming that the home directory of the user running tomcat is used to compile a report. How can I set the compile directory when using JasperCompileManager.compileReport ( InputStream ) to for example /tmp

 

Thanks in advance.

 

------------------

 

Edit 14:34 1 juni 2007

 

I have just examined the source code and I have discovered that the default behaviour is that reports are compiled to the home directory -> System.getProperty("user.dir");

 

Althought each programmer thinks differently I think we can agree that compiling to the users home directory is just plain poor programming thinking. Why not use System.getProperty("java.io.tmpdir") property to get the temp directory. That's what a temp directory is for, for doing such operations.

 

Or File temp = File.createTempFile("jasperreport_",".java"); and then save the java file to that file

 

Please dont see this as a jasperreport bashing, on the contrary I am very grateful that jasperreport exists, but please see this as positive critism.

Post edited by: martynhiemstra, at: 2007/06/01 14:43

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

The recommended way of compiling reports (especially in server applications) is to use the JDT-based report compiler which doesn't need a temp *.java file on the filesystem. So if you just include the jdt-compiler.jar distributed with JR (or the JDT jar from Eclipse), you will not need to worry about temporary report compilation files. Also remember that if you have a static set of reports, you should compile them during your application's build.

 

The default location choice for temp java files is indeed arguable, but on the other hand it's just a default and anyone can easily change it.

 

Regards,

Lucian

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...