The Java Web uses simple batch operations (Notepad +tomcat) _java

Source: Internet
Author: User
Tags java web

Before the use of the Web development is myeclipse, but only used people know that because of its plug-ins too much, and there are many plug-ins do not touch the function. So, once the project is a little bit larger will be very card, although it has been optimized before, but still feel less useful. Today, there is nothing to do, decided to try the most original method, using Notepad +tomcat for development. Although the efficiency is not very high, but familiar with the most basic of some operations, is quite rewarding. And in the blog, I will share what I think is the biggest harvest of today.

As we all know, we're going to deploy the project in Tomcat, and the. class file that you use needs to be saved to a specific directory (or, of course, to any directory in Tomcat's configuration file), and the stupidest way is to. After the Java file is compiled, the. class file is copied to the Web-inf subdirectory of the project classes, which is effective. Finally I tried to use batch processing to solve this problem. Under any directory, create a new file with a suffix named. bat, and use the following statement to generate a simple batch program:

Copy 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 variable, and we all know that Tomcat needs more than the system environment variable that we set up, and it relies on the jar package from the Lib in Tomcat.

The second sentence is to compile the source file using our Javac command, and the-D option means to save our compiled. class file to the directory written later, and%1 indicates that our source file is the first parameter.

The third sentence is the pause statement, that is, after the execution of the above two sentences, suspended. The interface shows "Press any key to end" ....

Here's my demo:

1. My classes directory is currently empty,

  

2. Drag Java source files that need to be compiled into Complie.bat:

  

3. Following completion of implementation:

  

4. After we go to the classes directory, we can see that the compiled. class file already exists in this directory:

  

Meow ~ is so simple, hehe.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.