When I was doing web development before, I used myeclipse, but those who have only used it know that because it has too many plug-ins, and the functions of many plug-ins are not accessible at all. Therefore, once the project is slightly larger, it will be very stuck. Although it has been optimized before, it still feels not very easy to use. I had nothing to do today, so I decided to try the most original method, using Notepad + Tomcat for development. Although the efficiency is not very high, it is quite rewarding to be familiar with some of the most basic operations. In this blog, I will share what I think is the biggest gain today.
We all know that if we want to deploy and run the project in Tomcat, the .class file used needs to be saved in a specific directory (of course it can also be modified to any directory in the Tomcat configuration file). The stupidest way is After compiling the .Java file, copy the .class file to the classes subdirectory of the project's WEB-INF. This will greatly affect efficiency. Finally I tried using batch processing to solve this problem. Create a new file with the suffix .bat in any directory and use the following statement to generate a simple batch program:
Copy the code code as follows:
set classpath=E:/bluemsun/tomcat/apache-tomcat/apache-tomcat-7.0.55/lib/servlet-api.jar;%classpath%
javac -d E:/bluemsun/tomcat/apache-tomcat/apache-tomcat-7.0.55/webapps/mm/WEB-INF/classes %1
Pause
The first sentence is to set the environment variables. We all know that what tomcat needs is not the system environment variables we set. It depends on the jar package in the lib in tomcat.
The second sentence is to use our javac command to compile the source file. The -d option means to save our compiled .class file to the directory written later. %1 means that our source file is the first parameter. .
The third sentence is the Pause statement, that is, after executing the above two sentences, it pauses. The interface displays "Please press any key to end"....
Here's my demo:
1. My classes directory is currently empty.
2. Drag the Java source files that need to be compiled into complie.bat:
3. After the execution is completed, the following is as follows:
4. After that, when we go to the classes directory, we can see that the compiled .class file already exists in this directory:
Meow~ It’s that simple, hehe.