How to make the compile and run Java become "automated"

Source: Internet
Author: User

  1. Create a batch file
    1. Create a new TXT file on the desktop
    2. Rename to Javabat.txt (be careful not to have the same command name as you already have, such as not allowing the batch file to be named Java.bat because Windows does not know exactly whether to call Java.exe or Java.bat)
  2. Add a command to a batch file
    1. DOS Common commands (capitalization doesn't matter)

      Rem for annotations, easy to get started reading the role of batch files

      Example:

      REM This batch file is used only for compiling and running Java programs, do not use it (at this point the text behind REM is not executed as a command, skip directly, just for reading)

      :: Same as comment command, subsequent text is just comment, not command

      Echo echoing command for printing subsequent text to the DOS screen (as-is output)

      Example:

      Echo Welcome to the Java World (output as shown below)

      @ Turn off single-line echo

      Example:

      If you add @ to the Echo Welcome to the Java World, what will it output?

      Careful you are not found "@echo Welcome to the Java World", but the direct output, which means whether the "echo Welcome to the Java World" or "@echo Welcome to the Java World" are interpreted as commands, but is similar to the C language printing function printf function. The function of @ is obvious, that is, do not need to output the line's command to the screen, that is, to turn off the echo, to know that the batch command is to perform the operation is written out, in order, then let the cmd (command interpreter) to read the command line by row and execute the corresponding process. Sometimes we write a batch file to achieve a purpose, often only need a portal (tell the consumer how to use the batch file) and a processed result, and do not need to let the user see the results of each step, you should use the @ command

      echo off starts from the next line to turn off Echo

      @echo off Turn off Echo function from bank start

      echo on starts from the next line to open the Echo

      Echo. Print a blank line (similar to line break in C \ n)

      %1,%2...%9 command-line arguments

      If you want your batch file to be more adaptable, you can use command-line arguments to resolve

      MD Create Directory

      RD Delete Directory

      Dir View all current directories and files

      CD Open Directory

      CLS Clear Screen

      . Current path

      .. Parent path of the current path

      Pause wait

      Other commands detailed explanation and usage please own Baidu.

    2. The collection of commands used to compile and run Java programs can be the following text

  3. Save the file with a. bat suffix and copy it to the C:\Windows\System32 directory so that the batch file can be used in any location
  4. Apply to compile and run Java programs

Summarize:

Using batch files makes it easy to do tedious tasks, freeing us to spend more time on the language itself. As long as you have an idea, you can write a simple development environment of your own.

How to make the compile and run Java become "automated"

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.