Setting classpath in Tomcat on AIX

Hi All
Can any one know how to set classpath for jsf application in tomcat on AIX.

Refer to the Tomcat's documentation regarding classpaths and classloading. The underlying operating system doesn't really matter.

Similar Messages

  • Setting Classpath in TomCat 5.5 for Custom Application

    I seem to have messed up my application. I cant access some of my java classes written and deployed in the WEB-INF/classes directory from a JSP Page stored in my app root.
    However, the fun part of this is if I create a package in WEB-INF/classes, store my java/class files in it and access these from the JSP using import, it works pretty fine. I'm unable to debug the scenario.
    I've given only the context path for the application in the server.xml. I suppose that would be sufficient for my application to be deployed, and need not specify any other classpaths anywhere.
    Please help me and correct me if i'm wrong.
    fun_one

    As of Java 1.4, if any class is in a package, then it can no longer access or import classes from the default (non) package.
    As of Tomcat 5.0, all TC classes, including the translated JSP pages, are in a package. That means that they can not access your classes that are not in a package.
    Your only option is the best one you should always do anyway: put all the classes in a package.

  • Setting classpath in Tomcat

    I can compile a Servlet that imports javax.servlet.http package through the command prompt. But when I try to access this class through Tomcat I gives an error, saying that it could not find the javax.servlet.http package.
    Doesn't Tomcat takes its classpath from the environment variable CLASSPATH, i.e., does it has it 's own classpath variable?

    Of course it doesn't. Thanks for the semantic
    correction, though. np! ;o)
    What I meant is that Tomcat 4 does
    not use the system classpath by default.No, you're right. I just checked my test-bed install and it has all the J2EE jar's it needs (inc. servlet.jar) in CATALINA_HOME/common/lib . I think that is the tomcat classloader's first port of call so it must load from there. OP, I think you have deployment issues. Try reinstalling tomcat, or possibly copying your J2EE jars to CATALINA_HOME/common/lib . I don't know if the copy will work, as I know that having things there that don't need to be there can cause big problems. Take your pick.

  • Once i set classpath to servlet-api.jar, it doesnt Instantiate DbBean.

    I am using notepad editor. I am trying to instantiate a DbBean class inside the servlet's init() method.
    once i set (C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar) this path to compile the Controller servlet.
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes>set classpath=C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes>javac Controller.java
    Controller.java:5: package bean does not exist
    import bean.DbBean;
    ^
    Controller.java:14: cannot find symbol
    symbol : class DbBean
    location: class Controller
    DbBean dbbean = new DbBean();
    ^
    Controller.java:14: cannot find symbol
    symbol : class DbBean
    location: class Controller
    DbBean dbbean = new DbBean();
    ^
    3 errors
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes>
    this is my servlet
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import bean.DbBean;
    public class Controller extends HttpServlet
    public void init(ServletConfig config)throws ServletException
    ServletContext context = config.getServletContext();
    context.setAttribute("base_url",config.getInitParameter("base_url"));
    {color:#ff0000}DbBean dbbean = new DbBean();{color} {color:#0000ff}error showing in this line
    {color}dbbean.setDburl(config.getInitParameter("dburl"));
    dbbean.setUserName(config.getInitParameter("username"));
    dbbean.setPassward(config.getInitParameter("pwd"));
    /// database bean can be access from jsp page
    context.setAttribute("dbbean",dbbean);
    /// Load the data base driver
    try{
    Class.forName(config.getInitParameter("jdbcDriver"));
    catch(ClassNotFoundException e)
    System.out.println(e.toString());
    super.init(config);
    public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException
    doPost(req,res);
    public void doPost(HttpServletRequest req, HttpServletResponse res)throws ServletException,IOException
    String base = "/onlinetest1/";
    String url = base + "login.jsp";
    String action = req.getParameter("action");
    if(action!=null)
    if(action.equals("successlogin.jsp"));
    url = base + "successlogin.jsp";
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url);
    dispatcher.forward(req,res);
    public void destroy()
    System.out.println("Servlet stopped");
    This below class can be put inside bean folder( (ie)sub dir of controller servlet)
    package bean;
    import java.sql.*;
    import java.util.*;
    import java.io.*;
    public class DbBean
    String dburl="";
    String dbuser="";
    String dbpass="";
    public void setDburl(String url)
    dburl = url;
    public void setUserName(String uname)
    dbuser = uname;
    public void setPassward(String pwd)
    dbpass = pwd;
    What to do to rectify this, please help me why this error coming,

    hi,
    Actually i did my ordinary package compilation example below, its run correctly, but after set classpath to %tomcat-home%\common\lib\servlet-api.jar(for same programs its not working) this kinds of error coming.
    F:\shyam\test>javac first.java
    F:\shyam\test>java first
    main class
    DB Set Correctly
    F:\shyam\test>set classpath=C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
    F:\shyam\test>javac first.java
    first.java:1: package bean does not exist
    import bean.DbBean;
    ^
    first.java:10: cannot find symbol
    symbol : class DbBean
    location: class first
    DbBean dbbean = new DbBean();
    ^
    first.java:10: cannot find symbol
    symbol : class DbBean
    location: class first
    DbBean dbbean = new DbBean();
    ^
    3 errors
    F:\shyam\test>
    In compilation it wont take DbBean class, please help me.
    thanks in advance,
    S.Shyam

  • Setting .jrxml in tomcat classpath

    Hi,
    I am using Jasper reports to build a HTML document. In my code i dont want to specify the absolute path of the .jrxml file for the tomcat server to recognize.
    Hence, in my code i want to use "contact.jrxml" instead of "c://contact.jrxml", simillarly for the generated .html as well where i should not specify the destination of .html with absoulte path. When i am using the absolute path tomcat is picking it up and generating the html. But when i give only the filename like "contact.jrxml" it is unable to find that, i have set the .jrxml file directory in Tomcat class path in eclipse. But still it is not able to pick it up. What may be the problem? Please do mention how to place the .jrxml and .html in classpath of tomcat? So that the server can pick it up with throwing an error. I tried copying the files in "webapps" and "bin" directory of tomcat but it didn't work as well. Hence, please do provide a solution for this.
    Thanks,
    Rithu

    Generally, in web technology,
    create a folder for user friendly in side yourwebapp/jrxml folder
    store all your .jrxml file there
    try with relative path,
    or
    keep path in the .properties file
    and while your webapp load, keep loading this configuration file and store in a property and use it where ever you need.

  • Set up the classpath for tomcat 5.0 to compile servlet

    I am totally confused how do you set up the class path, i use this command:
    c:\set CLASSPATH=.;C:\tomcat5.0\common\lib\servlet-api.jar;%CLASSPATH%
    and I compile my file which i put in j2sdk1.4.2_10\bin
    here is the command line:
    c:\j2sdk1.4.2_10\bin\servletexercise1.java
    and it gives me the error message to say that it can't find the servelt, javax.servlet.
    Please help! thanks in advance!

    I am totally confused how do you set up the class
    path, i use this command:
    c:\set
    CLASSPATH=.;C:\tomcat5.0\common\lib\servlet-api.jar;%C
    LASSPATH%I don't have a CLASSPATH environment variable on any machine that I work with.
    and I compile my file which i put in j2sdk1.4.2_10\binThat's a pretty stoopid place to put a Java source file. You shouldn't be putting any files in that directory.
    The right thing to do is to add the Java /bin directory to your PATH environment variable. When you do, make sure there are no spaces in the path name. (e.g., don't install Java to the "Program Files" directory) OR replace it with its 8-char DOS equivalent (e.g., c:\Progra~1).
    here is the command line:
    c:\j2sdk1.4.2_10\bin\servletexercise1.javaSorry, I don't see where you execute javac.exe.
    and it gives me the error message to say that it
    can't find the servelt, javax.servlet.
    Please help! thanks in advance!What is this telling you? That the javac.exe totally ignores the CLASSPATH that you set? (Hint: Right answer.)
    The correct way to do it is to use the -classpath option on javac.exe.
    %

  • Setting Classpath in linux

    Hi !! Can anyone help me in setting classpath in linux to run servlets/? I tried using this command..but didnt work
    export CLASSPATH="$CLASSPATH:/usr/share/tomcat5/server/lib/servlets-common.jar"
    Thanks
    Nive

    in ur autoexec.bat file write the following
    set PATH=C:\jdk1.5.0_04\bin;%PATH%
    set JAVA_HOME=C:\jdk1.5.0_04
    set
    CLASSPATH=.;C:\jakarta-tomcat-5.5.9\common\lib\servlet
    -api.jar;C:\jakarta-tomcat-5.5.9\common\lib\jsp-api.ja
    r;C:\Servlets+JSP;..;..\..;C:\jakarta-struts-1.2.4\lib
    \struts.jarThis response is meaningless. Principally because the OP specifically mentioned the use of LINUX. Not Windows.
    I've taken the advice of other forum users by avoiding a system level classpath variable. I define the classpath each time I compile and run. Working on Linux I tend to use command line argument files ( http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#commandlineargfile ) which eliminates the need to redefine the classpath each time I compile or run my classes and apps. But others may do things differently.
    Here is a website you might want to check out which pertains to setting the classpath on Solaris and Linux.
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html

  • How to set classpath and server configuration in eclipse

    i am new to eclipse tool pls anyone tell me to set classpath and serverconfiguration (tomcat) and sample program

    Get WTP [1], install it [2] and checkout one of the lot Eclipse WTP tutorials [3].
    [1] http://www.eclipse.org/webtools/
    [2] http://ftp.osuosl.org/pub/eclipse/technology/phoenix/demos/install-wtp/install-wtp.html
    [3] http://www.eclipse.org/webtools/community/tutorials/BuildJ2EEWebApp/BuildJ2EEWebApp.html

  • Package does not exist even though I set classpath right!

    Hi, my JSP got an error message saying "Package does not exist" at line
    <% import ="org.jfreechart.*"%>
    And I have put the myjar.jar file containing the above classes into blabla\WEB-INF\classes,(where blabla is my current working directory) and set my classpath= blabla\WEB-INF\classes
    It does not either if set classpath= blabla\WEB-INF\classes\myjar.jar
    Anybody could give suggestion? By the way I am using Tomcat.

    your .jar files should be in WEB-INF/lib

  • Help with setting classpath

    Hi All,
    I am new to servlets and JSP. I have a question regarding setting Classpath. My development directory structure is like this c:\..\desktop\java\project1\src\com\eg\web\e1.java. Servlet.jar file is in C:\Program Files\Apache Group\Tomcat 4.1\common\lib. I tried setting Classpath in windows 2000 using control panel=>System utility by this command
    SET CLASSPATH=.;c:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar . I try to compile my program by going into the whole development directory structure C:\..\src\com\eg\web using javac e1.java. But I get the error "package javax.servlet does not exist". Can somebody help me resolve this?
    Thank You in advance
    Jaya

    Question 1: Are you using an IDE?
    [IDEs ignore the system classpath]
    Question 2: Did you try setting the classpath using the -cp option for javac, if you are not using an IDE?
    [you could also try to print the classpath on command line to check if it has taken effect]

  • Urgent : How to include Win2K CLASSPATH  to Tomcat 4.2

    I am running a web application on Tomcat 4.1
    Tomcat 4.1 uses CATALINA_HOME and JAVA_HOME
    enviroment variables and from my knowledge of the settings
    it does not utilise the Win2K CLASSPATH variable.
    I use a number of *.properties files to access values and variables
    so I need to set the startup program of Tomcat to include CLASSPATH.
    Is this possible ?
    Secondly is there any other way of making the web application recognise
    these property files .
    Based on some suggestions I tried including the files with classes
    and adding a zip file.
    It works fine with Tomcat 3.2.4 as it includes CLASSPATH on startup.
    Could anyone suggest the solution for this as I searched the Tomcat websites and could not find a solution.
    Thanks
    manosham

    I looked at the Tomcat 4 startup file and it looks like it overwrites CLASSPATH in the bin/setclasspath.bat file. You can get around that by modifying that file. Look for this line near the end:
    set CLASSPATH=%JAVA_HOME%\lib\tools.jar... and change it to ...
    set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%CLASSPATH%Hope that helps :)

  • Problems setting classpath...

    hello guys...i am having a problem with what should be a very simple operation...
    the classes i define are stored in the classes directory..inside, each package has its own subdirectory...
    classes
    beans
    User.class
    Cart.class
    i have tried to change my classpath to reflect this location and instruct the compiler as to where to find those classes..
    i have used the set Classpath command...
    SET CLASSPATH=.;C:\Tomcat\common\lib\servlet-api.jar;C:\Tomcat\common\lib\mysql-connector-java-3.1.13-bin.jar;
    C:\Tomcat\webapps\theagent\WEB-INF\classes beans.User;
    but when i try to import beans.User in another class..it doesnt compile and tells me that the package doesnt exist...
    please help....what else do i need to check to make sure the configuration is as it should be...
    p.c User.java started with package beans;
    thanks

    That is correct because your beans.User class doesn't contain a
    public static void main(String[] args) method, iow you can't run it by itself.i dont want to run the class by itself... i just want to import beans.User;
    but it says that no such package exists...Then you have to be a bit more clear. You mentioned this command line:java -classpath C:\Tomcat\common\lib\servlet-api.jar;
    C:\Tomcat\common\lib\mysql-connector-java-3.1.13-bin.jar;
    C:\Tomcat\webapps\theagent\WEB-INF\classes beans.User;This sets the classpath pointing to two jars and a 'classes' directory.
    You're trying to run the 'beans.User' class which I presume is stored
    in a subdirectory of that 'classes' directory.
    The java command works like this:java -classpath <jars and dirs here> package.YourClass... so you were trying to run your beans.User class all by itself. It doesn't
    contain a main method hence the runtime diagnostic. btw, I don't know
    why you appeded that whole thing with a semicolon.
    kind regards,
    Jos

  • How can I add classpath in tomcat 4.0.3

    I am sorry to ask a newbie question but I am really dying to know the answer.
    I have tomcat4.0.3 installed and working.
    I have j2ee1.3.1 install and working.
    I have jboss3.0.0RC installed and working.
    now I want to use a EJB in tomcat application,
    the source file compile correctly.
    but I type http://192.168.100.24/tomcat/servlet/FirstServlet
    a ServletException throwed,tomcat complain javax.ejb.EJBHome class
    cannot be founded.
    I think it is a problem about classpath.but the environment variable
    classpath has included j2ee.jar and when I use j2ee to develop an
    web application I have never met such case.later I found a article
    says tomcat4.0.3 don't use system classpath.
    then I found a file named setclasspath.bat in bin directory,
    and I change the line 'set CLASSPATH=%CLASSPATH%' to
    'set CLASSPATH=%CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar'
    but the tomcat cannot startup.
    how should I do.
    BTW,how to get the information about tomcat fail to startup

    Throw your j2ee.jar into the WEB-INF\lib directory of your web app module. The servlet should pick it up there.

  • Can't compile Servlet program(error in setting classpath in XP)

    I encountered a similar problem as 'hereispaddy'.
    "I have recently written a servlet program. When I compile the program (let's say "HelloWorld.java"), I've got the following error message:
    package javax.servlet does not exist
    I've download the class files and set the classpath already. Have I missed anything? "
    i would like to ask, how to set the following in Windows XP:
    set CATALINE_HOME=C:\PROGRA~1\APACHE~1.0
    set CLASSPATH=.;%CATALINE_HOME%\COMMON\LIB\SERVLET.JAR;C:\JDK1.4\BIN;
    *ive tried in control panel->system->advanced->environment variables->
    variable name:CATALINE_HOME
    variable value:C:\Program Files\Apache Tomcat4.0 (and)
    variable name:CLASSPATH
    variable value:.;%CATALINE_HOME%\common\lib\servlet.jar;C:\jdk1.4\bin
    but failed!
    Could anyone kindly tell me what's wrong with my setting?
    Thx a lot!!!

    Does Tomcat work? Can run the examples on the home page?
    The only suggestion I have at this point is to get rid of the spaces in
    C:\Program Files\Apache Tomcat4.0
    But I am still in Win98 , so I am just guessing.

  • Help for set classpath

    Dear Sir \ Madam
    I have download javamail-1.4.zip and jaf-1.1.zip from sun at c:\j2sdk1.4.1 directory
    Then I extract these files in same directory with folders javamail-1.4 and jaf-1.1. These folders have mail.jar and activation.jar file
    I am confused to set correct path
    Please help me

    You could have looked into installation instructions bro!
    anyways classpath looks like this
    C:\j2sdk1.4.1_03\jre\lib\rt.jar;.;%classpath%;C:\Tomcat 4.1\common\lib\servlet.jar;
    Give your jar file location after lib. Set the PATH variable too, which would look similar to this:
    C:\j2sdk1.4.1_03\bin;C:\Tomcat 4.1\common\lib\servlet.jar;.;
    You can go to
    http://java.sun.com/j2se/1.3/install-windows.html
    or
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html
    for detailed notes.
    Hope it helps.
    Rk.

Maybe you are looking for

  • Hi, I'd like to uninstall this awful OS and go back to Tiger.

    Right. I can't stand snow leopard. It's an awful OS. It dwindles in comparison. And I want it GONE! It's completely screwed up very thing from Photoshop, to screen savers. And the worst thing? Quick Time. xI paid out for Quick Time pro back when I fi

  • Can I wipe my hard drive without reinstalling Mountain Lion?

    I'm running a digital version of Mountain Lion and my Mac is still running fine, but my hard drive is almost full. I'm an animation student, so I'm thinking of wiping it to get off all the junk that I don't really need for school, but I don't want to

  • Mail Can't Open & com.apple.internetaccount process hogging 100% CPU

    Desperately seeking answers after Mavericks install.. My mail crashed and now won't open at all. I've tried most (if not all) the suggestions posted by others.  Haven't tried deleting and reinstalling mail yet, as this will be my last resort since I

  • Program doesnt respont when i add canvas on enterFrame function

    Hello all! I have been making a simple aplication and i have a problem i cannot find the solution (neither why it is happening) The thing i want to do is to dynamically add a canvas containing a button to the application and then i want the canvas to

  • Graphics.drawLine and Graphics.drawRect do not match

    Using a Graphics.scale (not == 1.0, but the value is insignificant) often Graphics.drawLine and Graphics.drawRect do not match (with same and x and y-Values), there are differences of one pixel in x- and y-direction when you use JDK 1.6_Update12 and