1 Reply Latest reply on Aug 31, 2002 3:51 PM by jwcarman

    Classpath Question

    fstarsinic

      when i deploy me ear file (which deploys my war file)
      i check the classpath of tomcat using
      System.getProperty("java.class.path")
      and display it in the log4j logfile while
      accessing a web page.

      among the items in the classpath are NOT the
      jar files that i added to the META-INF/lib
      in the war file.

      i am trying to do this...

      String pResource =
      "/gov/ca/boe/afsp/wf/scripts/CreateEfileEntity.js";
      URL url = ClassLoader.getSystemClassLoader().getResource(pResource);


      but the resource is not found.

      when i put the jar file into jboss itself, all was ok.
      it seems that actual .class files are found. just not the resources.

      i'm assumming that a resource can have any name and not xxxx.properties??

      thanks,
      frank

        • 1. Re: Classpath Question
          jwcarman

          Why not put your resources in your webapp? You can use ServletContext.getResource() instead of the system classloader to load your resource. This way, your code is more portable and tightly packaged (IMHO). So, you could replace that line with...

          URL url = getServletContext().getResource( "/WEB-INF/scripts/CreateEfileEntity.js" );

          Hope this helps. :-)