Cov txheej txheem:

Kuv yuav ua li cas khiav Java cov ntaub ntawv hauv chav sib txawv?
Kuv yuav ua li cas khiav Java cov ntaub ntawv hauv chav sib txawv?

Video: Kuv yuav ua li cas khiav Java cov ntaub ntawv hauv chav sib txawv?

Video: Kuv yuav ua li cas khiav Java cov ntaub ntawv hauv chav sib txawv?
Video: YUAV COJ LI CAS TU NEEG KOJ HLUB THIAJ NCO KOJ 2024, Kaum ib hlis
Anonim

Hauv qab no yog cov kauj ruam los khiav java class file uas nyob rau hauv ntau directory:

  1. Kauj Ruam 1 (Tsim kev siv hluav taws xob chav kawm ): Tsim A.
  2. Kauj ruam 2 (Compile utility chav kawm ): Qhib davhlau ya nyob twg ntawm proj1 qhov chaw thiab ua ua raws li cov lus txib.
  3. Kauj Ruam 3 (Saib seb A.
  4. Kauj Ruam 4 (Sau lub ntsiab chav kawm thiab sau nws): Tsiv mus rau koj qhov project2 phau ntawv .

Hauv qhov no, qhov twg cov ntaub ntawv hauv chav kawm raug cawm hauv Java?

1. chav kawm ntawv hauv java ua yog generated thaum koj compile. java file siv ib qho Java compiler zoo li Sun's javac uas los ntawm JDK kev teeb tsa thiab tuaj yeem pom hauv JAVA_HOME / bin directory.

Kuv yuav ua li cas khiav ib.class cov ntaub ntawv hauv CMD?

  1. Qhib lub plhaub ntawm lub tshuab uas koj xav khiav.
  2. Hloov directory (cd) mus rau cov directory uas muaj cov kev pab cuam koj xav khiav.
  3. Xyuas kom tseeb tias qhov program tau muab tso ua ke.
  4. Nkag mus rau cov lus txib hauv qab no (nco ntsoov tias cov ntaub ntawv npe tau teev tseg yuav tsum yog. class file uas muaj ib txoj hauv kev tseem ceeb):

Ib tug kuj yuav nug, Kuv yuav ua li cas thiaj li khiav Java lub ntsiab lus los ntawm kab hais kom ua?

Khiav Java Program los ntawm Command Prompt

  1. public class HelloWorld { public static void main(String args) { System. tawm. println("Nyob zoo, ntiaj teb!"); }}
  2. cd DocumentsScripts.
  3. set path=%path%;C:Program FilesJavajdk-9.0.1in.
  4. javac HelloWorld.java.
  5. java HelloWorld.

Yuav nrhiav tsis tau lub cim txhais li cas hauv Java?

A " Nrhiav tsis tau lub cim " yuam kev txhais tau tias uas lub compiler ua tsis tau qhov no. Koj cov cai zoo li hais txog qee yam uas tus neeg sau tsis nkag siab. Koj Nrhiav tsis tau lub cim yuam kev cuam tshuam nrog cov cim thiab txhais tau tias uas Java ua tsis tau nrhiav qhov " cim " txhais tau tias.

Pom zoo: