Allcoware / TesterFactory

0 stars 0 forks source link

Log4j warning should eventually be addressed, while the program still works fine the issue lies in the classpath to the .jrxml file #5

Open jackal390iv opened 10 years ago

jackal390iv commented 10 years ago

while iReports can be configured in Netbeans, and be in the project folder, it is considered an external file that must be called by the program using JasperReports

Aenigma commented 10 years ago

I don't understand. Are you sure the two issues are related?

jackal390iv commented 10 years ago

http://programming.mvergel.com/2013/01/warn-no-appenders-could-be-found-for.html#.U-qZ4fldWSo

jackal390iv commented 10 years ago

http://www.coderanch.com/t/63230/open-source/log-log-WARN-appenders-logger

jackal390iv commented 10 years ago

so your right the problem may not be related, however do you have any suggestions on how the classpath to the .jrxml file should be handled? at the moment I just have a direct call

reportSource = "C:\Users\Reaper\Documents\NetBeansProjects\TesterFactory\build\classes\testerfactory\cabReport.jrxml";

jackal390iv commented 10 years ago

http://burtbeckwith.com/blog/?p=31

jackal390iv commented 10 years ago

I mean the file is in the project folder.. "\build\classes\testerfactory\cabReport.jrxml" there should be an easy way to do this that is just slipping my mind at the moment

Aenigma commented 10 years ago

This problem is two-fold. A philosophical and a technological one.

The question is, as a user, where do you want a file like this? Do you want it to be invisible and taken care of, or do you want to be able to add more files and/or modify them? What choice do we have in the matter? If you want to put it an external folder, how would you get the file there, initially?

First off, you can package certain files as resources within a JAR file and access them using getResource(). This is described more concretely here. In our other project, we are working with Maven, which makes this a bit easier, as it has its own resources folder that Maven understands. Using that is also mentioned a bit in this guide.

Perhaps you'd want them in a separate directory, though? Which directory, then? It Windows, one would typically use %APPDIR% for things like this. We could create a folder and check if there are extra resources there and copy our pre-packaged files there. In Linux/OSX, you'd probably use a hidden folder in your home directory.

The question becomes unfortunately non-trivial. Consider sticking with trying to use it as a resource for now and we can fix the question of whether to put it a folder on the system later. Also, when you use paths in Java, always use forward slashes.