Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

JSP development environment construction


May 12, 2021 JSP


Table of contents


JSP development environment

The JSP development environment is where you can develop, test, and run JSP programs.

This section will take you through the JSP development environment, including the following steps.


Configure Java Development Tools (JDK)

This step involves downloading the Java SDK and configuring the PATH environment variables.

You can download SDK: Java SE Downloads from Oracle's Java page

After the Java SDK is downloaded, follow the given instructions to install and configure the SDK. F inally, by setting PATH and JAVA_HOME environment variables, you can indicate folder paths that include java and java, java_install_dir/bin and java_install_dir.

If you're using a Windows system and the SDK's installation directory is C::jdk1.5.0_20, you'll need to add the following two lines to the C:.bat autoexec file:

set PATH=C:\jdk1.5.0_20\bin;%PATH%
set JAVA_HOME=C:\jdk1.5.0_20

Or, under Windows NT/2000/XP, you can just right-click on my PC icon, select properties, then advanced, and then environment variables, so you can easily set the PATH variable and make sure you exit.

Under Linux/Unix, if the SDK's installation directory is /usr/local/jdk1.5.0_20 and you are using a C shell, you will need to add the following two lines to the .cshrc file:

setenv PATH /usr/local/jdk1.5.0_20/bin:$PATH
setenv JAVA_HOME /usr/local/jdk1.5.0_20

Or, if you're using an integrated development environment like Borland JBuilder, Eclipse, IntelliJ IDEA, and Sun ONE Studio, try compiling and running a simple program to determine whether the IDE (Integrated Development Environment) already knows the installation directory for the SDK.

You can also refer to the tutorial in the Java Development Environment Configuration section of this step.


Set up a Web server: Tomcat

Currently, there are many Web servers on the market that support JSP and Servlets development. S ome of them are free to download and use, and Tomcat is one of them.

Apache Tomcat is an open source software that can run JSPs and servlets as separate servers or be integrated into Apache Web Server. H ere's how Tomcat is configured:

  • Download the latest version of Tomcat: http://tomcat.apache.org/.
  • After downloading the installation file, unzip the compressed file to a convenient place, such as the C: .apache-tomcat-5.5.29 directory under Windows or the /usr/local/apache-tomcat-5.5.29 directory under Linux/Unix, and then create a CATALINA_HOME environment variable to point to those directories.

Under Windows machines, Tomcat can start by executing the following command:

%CATALINA_HOME%\bin\startup.bat
或者
C:\apache-tomcat-5.5.29\bin\startup.bat

On Linux/Unix machines, Tomcat can be started by executing the following command:

$CATALINA_HOME/bin/startup.sh
或者
/usr/local/apache-tomcat-5.5.29/bin/startup.sh

Once Tomcat is successfully launched, you can http://localhost:8080/ some of Tomcat's own web applications by accessing the data. I f all goes well, you should be able to see the following pages:

JSP development environment construction

More information about configuring and running Tomcat can be found in the documentation provided by Tomcat, or go to Tomcat's official website: http://tomcat.apache.org.

Under Windows machines, Tomcat can stop by executing the following command:

%CATALINA_HOME%\bin\shutdown
或者
C:\apache-tomcat-5.5.29\bin\shutdown

On Linux/Unix machines, Tomcat can stop by executing the following command:

$CATALINA_HOME/bin/shutdown.sh
或者
/usr/local/apache-tomcat-5.5.29/bin/shutdown.sh

Set the CLASSPATH environment variable

Because servlets are not part of Java SE, you must mark the compiler of the servlet class.

If you're using a Windows machine, you'll need to add the following .bat the C: . . . autoexec file:

set CATALINA=C:\apache-tomcat-5.5.29
set CLASSPATH=%CATALINA%\common\lib\jsp-api.jar;%CLASSPATH%

Or, under Windows NT/2000/XP, you can just right-click on my computer, select the properties, then click Advanced, then click on the environment variable, and then you can set the CLASSPATH variable and determine the exit.

Under linux/Unix machines, if you're using a C shell, you'll need to add the following two lines to the .cshrc file:

setenv CATALINA=/usr/local/apache-tomcat-5.5.29
setenv CLASSPATH $CATALINA/common/lib/jsp-api.jar:$CLASSPATH

Note: If your development path is C:\JSPDev (Windows) or /usr/JSPDev (Linux/Unix), you need to add these paths to the CLASSPATH variable.