Abstract: how kind runtime environment configuration JSP 
  How kind runtime environment configuration JSP 
  First, download tools: 
  I suggest that beginners use JDK Editplus +, I think that if we use such as JB, Eclipse, JCreator, although just at the beginning of more convenient, but it does lead to beginners do not know how the door configuration environment variable, 
  Thus making it difficult to know these, know why they are so the state can be downloaded from the following address: 
  Editplus (the latest version is v2.11): http://count.skycn.com/softdown.php?id=3641&url=http://sc-http.skycn.net/down/epp211a_cn.exe (as a registration key to find it on their own, many of the Internet) 
  JDK (the latest version is Java2sdk1_4_2): http://count.skycn.com/softdown.php?id=3116&url=http://sc-http.skycn.net/down/j2sdk-1_4_2-windows-i586.exe ( This is For Windows) 
  Then JDK is installed, I installed it to the c: \ JDK directory: 
  CLASSPATH then is the problem: 
  As the operating system use PATH to search executable programs, the Java runtime environment will be to find Ergodic CLASSPATH category, even HelloWorld such a simple procedure, will traverse JVM 
  CLASSPATH definition of each path, until you find the corresponding documentation so far. 
  We believe that the systems in use is not 2 k XP, and then on the Path should be set up as follows: 
  My computer -> Properties -> High -> environment variables and then the Path environment variable behind Supplementary: C: \ JDK \ bin;. C: \ JDK \ lib 
  This configuration can be: C: \ JDK \ bin;. C: \ JDK \ lib \ dt.jar; C: \ JDK \ lib \ tools.jar 
  รข˜… Remember: in the environment variable. Remember not less, it said that the current path, but less if the mistakes, and so will say! 
  Dt.jar is on the operating environment of class libraries, tools tools.jar is on the Class if there is no configuration: C: \ JDK \ bin, will be a "javac 'is not an internal or external command, it can not run the program or batch file. "Such a mistake. 
  Then write the procedures below: 
  The first is (HelloWorld.java), opened Editplus, a new Java files, in keeping with the following input, the word not to leak, and to distinguish between upper and lower case: 
  Public class HelloWorld ( 
  Public static void main (String [] args) ( 
  System.out.println ( "Hello, World!"); 
  ) 
  ) 
  This then save the file (ctrl + s) to HelloWorld.java, we must remember to distinguish between upper and lower case, is not helloworld.java HelloWorld.java or other Below the running start -> run -> cmd 
  In the console switch to the directory in the current directory: 
  Javac HelloWorld.java 
  Java HelloWorld 
  You will see the console output Hello, World! (No? I eat a computer:)) 
  Javac compiler is an order it to compile into HelloWorld.class HelloWorld.java 
  Java is explained orders, the HelloWorld.class explained JVM implementation. 
  At this time: 
  1.    If there Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld 
  It is in your environment variables that did not add. (Dot) 
  2.    If there Exception in thread "main" java.lang.NoSuchMethodError: main 
  Or HelloWorld.java: 1: Public class helloworld must be defined in a file called 
  "HelloWorld.java." 
  That is, you do not have to distinguish between upper and lower case writing this HelloWorld, or preserved for the time did not keep HelloWorld.java 
  The name will follow the same public class names 
  For the problem of environment variables Here, I first say how Below Editplus inside the building and operation of the Tools-> Settings -> configuration user tools 
  1. Add tools (add applications) 
  Menu text: Compile Java Program 
  Procedure: C: \ JDK \ bin \ javac.exe 
  Parameters: the initial directory file name: document directory 
  2. Add tools (add applications) 
  Menu text: Run Java Program 
  Procedure: C: \ JDK \ bin \ java.exe 
  Parameters: the file name (without extension) 
  Initial Catalog: file directory 
  Tool name can easily add, for example, Debug Java Program 
  Then in the Tools pull-down menu, you will see Compile Java Program Run Java Program, as well as the two options, since you can use a ctrl + compiler and the operational procedures ctrl +2 
  Below Servlet discussion on the Run: 
  Servlet first run, the need for JSP / Servlet container, I suggest that beginners use Tomcat 
  Tomcat (the latest version 5.0): http://cvs.apache.org/builds/jakarta-tomcat-5/nightly/jakarta-tomcat-5-bin-20030725.zip 
  Then extract the compressed to: 
  C: \ Tomcat 
  Then configuration environment variable: 
  Add three systems variables: 
  JAVA_HOME: C: \ JDK 
  TOMCAT_HOME: C: \ Tomcat 
  CLASSPATH:% JAVA_HOME% \ lib;% TOMCAT_HOME% \ lib 
  Tomcat environment variables on the configuration finished, the following test Tomcat whether to run: 
  In the console to the C: \ Tomcat \ bin directory of this, the startup operation, and then back to the emergence of a window, and even a long jump things, and finally said Server has been running in the browser input http://localhost:8080, a welcome interface , it will be no problem for the Tomcat, and then above, write your first Servlet 
  Import java.io. *; 
  Import javax.servlet .*; 
  Import javax.servlet.http .*; 
  Public class HelloWorld extends HttpServlet 
  ( 
  Public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
  ( 
  Response.setContentType ( "text / html"); 
  PrintWriter out = response.getWriter (); 
  Out.println ( "       "); 
  Out.println ( " 
Subscribe to:
Post Comments (Atom)
 
 
No comments:
Post a Comment