WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

JSP development environment build


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

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


Configuring Java Development Tools (JDK)

This step involves the download of the Java JDK and the configuration of the PATH environment variable.

You can download the JDK from the Oracle company's Java page: Java SE Downloads

Once the Java JDK is downloaded, follow the instructions given to install and configure the JDK. Finally, specify the folder path to include java and javac by setting the PATH and JAVA_HOME environment variables, typically java_install_dir/bin and java_install_dir.

If you are using a Windows system and the JDK installation directory is C::\jdk1.5.0_20, then you need to add the following two lines to the C:\autoexec.bat 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 right-click on the My Computer icon, select Properties, then Advanced, then Environment Variables, and then you can easily set the PATH variable and make sure you exit.

On Linux/Unix systems, if the JDK installation directory is /usr/local/jdk1.5.0_20 and you are using the C shell, you will need to add the following two lines to the .cshrc file:

setenv PATH /usr< /span>/local/ Jdk1.5.0_20/bin:$PATH
Setenv JAVA_HOME /usr/local/jdk1.5.0_20

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

Setting the web server: Tomcat

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

Apache Tomcat is an open source software that can be used as a standalone server to run JSPs and Servlets, or it can be integrated into Apache Web Server. Here is the configuration method for Tomcat:

  • Download the latest version of Tomcat: http://tomcat.apache.org/.
  • After downloading the installation files, extract the compressed files to a convenient location, 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 the CATALINA_HOME environment variable to point to these directories.

On a Windows machine, Tomcat can be started by executing the following command:

%CATALINA_HOME%\bin\startup.bat
or 
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< /span>/startup. Sh
or 
/usr/local/apache-tomcat-5.5.29/bin/< Span class="pln">startup.sh

After successfully starting Tomcat, you can use some of the web applications that come with Tomcat by visiting http://localhost:8080/. If all goes well, you should be able to see the following page:

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

On a Windows machine, Tomcat can be stopped by executing the following command:

%CATALINA_HOME%\bin\shutdown
or 
C:\apache-tomcat-5.5.29\bin\shutdown

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

$CATALINA_HOME/bin< /span>/shutdown. Sh
or 
/usr/local/apache-tomcat-5.5.29/bin/< Span class="pln">shutdown.sh

Set the CLASSPATH environment variable

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

If you are using a Windows machine, you will need to add the following two lines to the C:\autoexec.bat 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 right-click on my computer, select Properties, then click Advanced, then click Environment Variables, then you can set the CLASSPATH variable and be sure to exit.

On a Linux/Unix machine, if you are using the C shell, you will 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-< Span class="pln">api.jar:$CLASSPATH

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