The JSP development environment is where you develop, test, and run JSP programs.
This section will help you set up a JSP development environment, including the following steps.
This step involves downloading the Java SDK and configuring the PATH environment variable.
You can download the SDK from Oracle's Java page: Java SE Downloads
After downloading the Java SDK, follow the given instructions to install and configure the SDK. Finally, specify the folder path including java and javac by setting the PATH and JAVA_HOME environment variables, usually java_install_dir/bin and java_install_dir.
If you are using a Windows system and the SDK 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_20bin;%PATH%set JAVA_HOME=C:jdk1.5.0_20Or, under Windows NT/2000/XP, you can right-click the My Computer icon, select Properties, then Advanced, then Environment Variables. Then you can easily set the PATH variable and confirm to exit.
Under Linux/Unix systems, if the SDK installation directory is /usr/local/jdk1.5.0_20 and you are using C shell, then you 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_20Alternatively, if you are using an integrated development environment such as Borland JBuilder, Eclipse, IntelliJ IDEA and Sun ONE Studio, you can try compiling and running a simple program to determine whether the IDE (integrated development environment) already knows the SDK installation directory .
You can also refer to the tutorial in the Java development environment configuration chapter of this site for this step.
Currently, there are many web servers on the market that support JSP and Servlets development. Some of them are free to download and use, Tomcat is one of them.
Apache Tomcat is an open source software that can be used as a standalone server to run JSP and Servlets, or can be integrated into the Apache Web Server. The following is the configuration method of Tomcat:
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 the CATALINA_HOME environment variable pointing to these directories.
Under Windows machines, Tomcat can be started by executing the following command:
%CATALINA_HOME%binstartup.bat or C:apache-tomcat-5.5.29binstartup.batUnder Linux/Unix machines, Tomcat can be started by executing the following command:
$CATALINA_HOME/bin/startup.sh or /usr/local/apache-tomcat-5.5.29/bin/startup.shAfter successfully starting Tomcat, you can use some of the web applications that come with Tomcat by accessing http://localhost:8080/. If all goes well, you should see the following page:
More information about configuring and running Tomcat can be found in the documentation provided by Tomcat, or go to the Tomcat official website: http://tomcat.apache.org.
Under Windows machines, Tomcat can be stopped by executing the following command:
%CATALINA_HOME%binshutdown or C:apache-tomcat-5.5.29binshutdownUnder Linux/Unix machines, Tomcat can be stopped by executing the following command:
$CATALINA_HOME/bin/shutdown.sh or /usr/local/apache-tomcat-5.5.29/bin/shutdown.shSince servlets are not part of Java SE, you must flag the compiler for the servlet class.
If you are using a Windows machine, you need to add the following two lines to the C:autoexec.bat file:
set CATALINA=C:apache-tomcat-5.5.29set CLASSPATH=%CATALINA%commonlibjsp-api.jar;%CLASSPATH%Or, under Windows NT/2000/XP, you just need to right-click My Computer, select Properties, then click Advanced, then click Environment Variables, then you can set the CLASSPATH variable and confirm to exit.
Under Linux/Unix machines, if you are using the C shell, then you need to add the following two lines to the .cshrc file:
setenv CATALINA=/usr/local/apache-tomcat-5.5.29setenv CLASSPATH $CATALINA/common/lib/jsp-api.jar:$CLASSPATHNote: If your development path is C:JSPDev (Windows) or /usr/JSPDev (Linux/Unix), then you need to add these paths to the CLASSPATH variable.