Why My Java Application can't see the *.jrxml?

前端 未结 1 1258
悲哀的现实
悲哀的现实 2020-12-20 07:48

My project has the following architecture : \"enter

My template is \"report1.jrxml\",

相关标签:
1条回答
  • 2020-12-20 08:21

    Jasper reports can't see it because the file is an embedded resource (it doesn't exist as a file, but a entry in the Jar file)

    You need to get a reference to it by using getClass().getResource("/testjasper/report1.jrxml") which will return a URL.

    From memory, you should be able to Jasper a InputStream, this can be achieved by using URL#openConnection

    0 讨论(0)
提交回复
热议问题