Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
ServletExec Self-Help: FAQ
Back to Search >  Back to Search Results

Faq ID 177
Product ServletExec
Category Class Loading/Reloading, JSP
Question How can I put my classes into the classpath ?
Answer For a web application, you put your .class files into the:
...\WEB-INF\classes\ folder
or put them in a JAR file and then place that JAR file into the:
...\WEB-INF\lib\ folder.
For classes that you want to be visible container-wide (visible to any code running inside of ServletExec):
  • For SE AS:
    The ...\Program Files\New Atlanta\ServletExec AS\se-<instanceName>\classes\ folder is already added to the main SE classpath so if you like you may simply place your .class files there (in a directory structure that mimicks their package names).
    Another option is to edit the StartServletExec batch/script file to include the folder or JAR file in the -classpath option that is passed to the JVM at startup.

    SE FAQ #33 may also be helpful.
    Here is an example showing how to add H:\myClasses and H:\myJars\a.jar to the Main/Global SE classpath for SE 6.0 AS:
    
    ...
    set cp=%cp%;%seInstanceHome%\classes
    set cp=%cp%;H:\myClasses
    set cp=%cp%;H:\myJars\a.jar
    ...
    
    
    After saving the edits to the file, stop SE, count to 3 (to give the JVM time to truly stop), and then start SE.
    Then navigate to the "classpath" page of the SE Admin UI (in your browser) to confirm that the entries you just added appear in the classpath listed there.
  • For SE ISAPI, or SE NSAPI:
    Add the folder containing the class, or add the absolute path to the JAR file to the Main Classpath on the Main ServletExec Admin UI

In all cases, the .class file must reside in a folder structure that mimicks the package name.
This is a Java thing.
This is discussed in section 4.2.3 of the ServletExec 4.1 User Guide.
The exampleWebApp that comes with ServletExec, has some JSPs which make use of Helper beans that are in packages. Study the exampleWebApp to see how this is done.

NOTE: If you are trying to use a class from your JSP:
A JSP is compiled into a Servlet, and with ServletExec, that servlet is declared to be part of the "pagecompile" package. So if your JSP wants to use a Bean/Helper class then you will need to add a page directive to your JSP, importing the package of the Bean/Helper class.
Note that modifying the Operating System Environment Variable named "CLASSPATH" is not likely to have any effect on the JVM in which ServletExec runs because by default, that JVM is not configured to look at or know about or care about the value of that OS Environment variable. The only way that variable would be used by SE is if it were mentioned in the Main/Global classpath. For example: set cp=%cp%;%CLASSPATH%



   
company media information terms of use privacy policy contact us