How to use command line cmd to execute a Java program

Source: Internet
Author: User

What if you don't have an IDE like idea Eclipse on your computer, but what happens when you need to execute Java code for the job?

This is the time to use the most primitive way to execute the command line

1: first you have to install the JDK and JRE (please check the information here)

2: find the Bin directory in your Java program workspace and copy it down the Eg:bin directory is the Java code compiled file directory

As follows:

We found that there are many. class files, which are both our compiled files

3: enter cmd (win+r input cmd enter)

4: access to your java-located disk

As Follows: enter D: carriage return

4: Enter cd+ space + The bin address just copied

As follows:

5: if Your. class file is not stored under the package or in the default bag, enter java+ space + file name (remove. Class)

If Your. class file is inside the package, you will need to change the file name to the following name: enter java+ space + package Name. file name (remove. Class) Enter

Thanks for learning!

How to use command line cmd to execute a Java program

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.