0

Access/Load a non-java resource (zul file) in JAR file

asked 2015-03-26 11:54:32 +0800

ifmis gravatar image ifmis
1 2

I have a Maven ZK Multi-Module project.

I want to put the common resources [java files, images, zul files and css/js files] in one module(Let say -- common.jar). Then make other many modules [.war] dependent on this jar module.

The structure:

  1. common.jar
  2. a.war
  3. b.war
  4. c.war
  5. d.war
  6. a, b, c & d dependent on common.jar.

The problem is that I am not able to load/access the non-java resources in those war modules.

Tip: I used this example: Inter-Web-Application Communication, but i failed to make it work.

Please I appreciate any help that can be given because I don't want to copy these same resources at every module.

Thanks

delete flag offensive retag edit

3 Replies

Sort by » oldest newest

answered 2015-03-27 02:20:40 +0800

echarish gravatar image echarish flag of Japan
1809 7
http://jp.linkedin.com/in...

how are you trying to access them in your project from common.jar, are you using relative path or absolute path, if you show us the code where you refer these resource, we will be able to help you better

link publish delete flag offensive edit

answered 2015-03-30 15:47:28 +0800

ifmis gravatar image ifmis
1 2

Dear Echarish,thank you in advance.

I said that I followed the Zkoss Inter-application communication example where they use the Classpath. But if you look well, there is no big difference with Relative Path.

For example: To access template-addon.xml, I use <language-config>      <addon-uri>~common/template-addon.xml</addon-uri> </language-config> this template-addon.xml resides in the root of common.jar.

Thanks!

link publish delete flag offensive edit

answered 2015-03-31 05:21:53 +0800

echarish gravatar image echarish flag of Japan
1809 7
http://jp.linkedin.com/in...

updated 2015-03-31 05:22:27 +0800

It would have helped to understand better how you are referring your resource in your a.war or b.war, i mean the code like if you refer them in web.xml or zul pages or somewhere else...

anyway here is what i would try to look

  1. suppose my resource is in common.jar, and my common.jar project is like this common/src/resource/customProperties.properties

  2. now to refer this property file in my war project i.e. a.war, i would refer it as classpath:resource/customProperties.properties, either in web.xml or if you use spring than in context files as well.

in case you are putting your resouces in some folder other than src of your jar, make sure when the jar is being exported that folder is getting exported as well.

let me know if it helps you in anyway.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-03-26 11:54:32 +0800

Seen: 48 times

Last updated: Mar 31 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More