4 Replies Latest reply on Aug 21, 2006 2:47 PM by technobrat

    Application's CLASSPATH

    codetwister

      Hi,
      I have a .jar that is application specific, for example funnyUtility.jar. I would like that jar to be available-visible only to my application myApp, that is myApp.ear. How should I set the classpath for myApp only?
      I know I can do it with JBOSS_CLASSPATH but that is server wide. Right?

      Is it correct to do it with
      myApp.ear\META-INF\MANIFEST.MF with Class-path=./lib/funnyfUtility.jar?

      Thanks.

        • 1. Re: Application's CLASSPATH
          codetwister

          One more thing.
          I also know I could package that jar, funnyUtility.jar, with myApp.ear. Is that righ thing to do or there is some other way?
          Let's say I do that, do I still have to set the CLASSPATH and if yes how should I set the CLASSPATH that is application's specific and not server wide? What's the best place to store application's-external jars?
          Thanks.

          • 2. Re: Application's CLASSPATH
            jaikiran

            You can place the funnyUtility.jar inside your myApp.ear. After placing it in the .ear file, to make it available in the classpath, you will have to add an entry in the application.xml file present in your myApp.ear/META-INF directory. The entry will be as follows:

            <module>
            <java>funnyUtility.jar</java>
            </module>




            • 3. Re: Application's CLASSPATH
              codetwister

              Thanks.
              But I would like not to place funnyUtility.jar inside myApp.ear because one day those jars could be required by onother application. Could I just have some directory on the server where I would store applicatiopn's specific jars and then to set the CLASSPATH, that is application's specific CLASSPATH not server wide, to it?

              • 4. Re: Application's CLASSPATH
                technobrat

                Looks like you want to have your cake and eat it too.
                Luckily, I think you can. Take a look at http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossClassLoadingUseCases

                You could try by creating a classloading scope for your myApp.ear (which contains funnyUtility.jar) and then simply reuse that classloading scope for other ears which need access to funnyUtility.jar.