CMD under compile run Java program

Source: Internet
Author: User

Get ready for the 1:JDK.

Preparation 2: Environment variable configuration OK.

Preparation 3: This test is JDK8, with JDK10 in eclipse it seems to be unable to use

Meet the above three conditions, it can continue to watch

test_1: Run with package compilation

Code:

 Package HelloWorld;  Public class helloworld{    publicstaticvoid  main (String [] args) {        System.out.println ("Hello World!!!" );    }}

File Location:

compiler directive:javac-d. Helloworld.java (Note-D is followed by A. dot)

Run Result:(need to run with Java package name/file name)

After executing the java instruction, a new folder is created under the current folder, named the package XXX name in your program, here is HelloWorld

If you execute Java HelloWorld directly:

Test_2: Run without package compilation

Code:

 Public class helloworld{    publicstaticvoid  main (String [] args) {        System.out.println ("Run without package compilation");}    }

File Location:

compiler directive:Javac Helloworld.java (note: Compiled bytecode files and source files in the same directory)

Operation Result:

CMD under compile run 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.