当前位置:网站首页>DOS command virtual environment
DOS command virtual environment
2022-06-11 09:19:00 【lwj_ 07】
common DOS command :
exit Quit current DOS Command window
cls Clear the screen
dir List all the sub files in the current directory / subdirectories
cd command :
cd Path to directory
But paths include absolute paths and relative paths
Absolute path : Indicates the path from the drive letter of a disk as the starting point
Relative paths : Indicates the path from the current path as the starting point
cd.. Go back to the parent directory
cd\ Back to root
del *class : eliminate class Source file
How to switch drive letters :
c: enter
d: enter
f: enter
e: enter
8、 About widows Setting the file extension of the operating system :
As java The programmer , To create a new one later .java Final document , So you must ensure that the file extension is .java
How to do it? ?
Turn on the computer ---》 see ---》 Hide file type extensions ( Remove the check mark in the front )
9、 java Compile phase Operation phase
JDK After the installation is completed, except for a self-contained javac.exe outside , There's another tool / command , be called java.exe
java.exe Mainly responsible for the operation stage .
-java.exe Where can I use ? How to use it? ?
stay DOS Use... In the window
java.exe How to do? ?
java Class name
for example :
There's one on the hard disk A.class Then use it like this : java A
Be careful : Don't write like this :java A.class [ FALSE ]
-javac How to do? ? Where can I use it ?
-javac Rules of use :
javac java Path to source file
- stay DOS Use... In the window
javac It's a java Compiler tools / command
The process of the operational phase is :
* open DOS Command window
* Input :java A
*java.exe Command will start java virtual machine (JVM),JVM Will start class loader ClassLoader
*ClassLoader I'm going to search the hard disk A.class file , If the file is found, load the bytecode file to JVM among
*JVM take A.class Bytecode files are interpreted as binary 101010101010 Data like this
* Then the operating system performs binary and interacts with the underlying hardware platform
10、 Start the first one java Program
* Make sure you have a text compiler installed on your computer Editplus
* install JDK
JDK Introduction to the catalogue :
JDK/bin: There are many commands in this directory , for example javac.ex and java.exe
javac.exe Responsible for compiling
java.exe Responsible for operation
* compile java Program :
Development HelloWorld.java Source program 【 To copy verbatim , Don't ask why , Pay attention to case 】
- take HelloWorld.java Source program through javac Tools to compile :
The first problem to be solved is :javac Is the command available
* open DOS Command window , Direct input javac And then go back , The following appears :
'javac' Not an internal or external command , It's not a runnable program
Or batch files .
The above problems are due to : windows The operating system could not find javac Command file
- How to solve the above problems javac The problem of unavailability ? ( Configure environment variables )
windows How does the operating system search for a command on the hard disk ?
* First, it will search from the current directory
* If the current directory cannot be searched , From environment variables path Search the specified path for a command
* If you can't find them all , The above error is reported .
- javac How to use the order ?
javac java Source file path
Be careful : Path includes relative path and absolute path , Fine .
* function java Program :
- Need to use java.exe command
- First test java Is the command available
- Usage mode :
java Class name
On the hard disk HelloWorld.class, So the class name is : HelloWorld
java HelloWorld
Be sure to pay attention to :java The command is not followed by a file path , Is the name of a class .
First of all, you need to put DOS The directory in the window switches to Hel1oWorld.class File directory .
And then directly execute : java Helloworld
*java How to write the notes in ?
- Single-line comments
// Single-line comments , Comment only the current line
- Multiline comment
/*
Multiline comment
Multiline comment
Multiline comment
Multiline comment
Multiline comment
*/
One javadoc notes
/**
* javadoc notes
* javadoc notes
* javadoc notes
*/
Be careful : This kind of annotation is more professional , The annotation information will be javadoc.exe The tool parses, extracts and generates help documents .


1、 Development HelloWorld.java Source program and comments
// public Public
// class class
// HelloWorld Class name
public class HelloWorld{ // Represents the definition of an open class Naming HelloWorld
// The class body 【 remember 】
// Direct writing of... Is not allowed in class bodies java sentence 【 In addition to declaring variables 】
// System.out.println("Hello World!");
/* public Open
static Static
void empty
main Method
(String[] args) It's a main Method's formal parameter list
Here's the thing to remember :
The following method is a program " Main method ", Is the execution entry of the program
public static void main(String[] args) Represents the definition of an exposed static main method
*/
public static void main(String[] args){
// Method body
// Method body
// Method body
System.out.println("Hello World!");
// Output a Chinese
System.out.println(" Hello !");
System.out.println(" I am a 'dsb'");
}
}

2、public class and class The difference between
* One java Multiple... Can be defined in the source file class

* One java In the source file public Of class It's not necessary
* One class Will generate a definition of xxx.class Bytecode file

* One java If the public class is defined in the source file ,public Of class There can only be one , And the class name must be the same as java Source file names are consistent Otherwise, the report is wrong :

* every last class You can write main Method , You can set the program entry , Want to execute A.class Medium main Method : java B
Be careful : When executed in a command xxx.class There must be... In the time program main Main method There is no master method, and there will be runtime errors

边栏推荐
- [share] how do enterprises carry out implementation planning?
- Modularnotfounderror: no module named 'find_ version’
- Sed explanation of shell script (SED command, sed -e, sed s/ new / old /...)
- Bowen dry goods | Apache inlong uses Apache pulsar to create data warehousing
- MySQL startup error "bind on tcp/ip port: address already in use"
- 【方案开发】血压计方案压力传感器SIC160
- 服装ERP:企业如何进行施行规划?
- Customize PCBA scheme and develop wrist sphygmomanometer scheme
- 远程办公最佳实践及策略
- [scheme development] scheme of infrared thermometer
猜你喜欢

机器学习笔记 - 使用TensorFlow的Spatial Transformer网络

Ecological co construction | 2021 streamnational excellent partner of the year comes out!

机器学习笔记 - 深度学习技巧备忘清单

山东大学增强现实实验四

Complexity analysis of matrix inversion operation (complexity analysis of inverse matrix)

Install jupyter in the specified environment

实现边充边OTG的PD芯片GA670-10

Type-C Bluetooth speaker single port rechargeable OTG solution

Typescript -- preliminary study of variable declaration

Kubelet error getting node help
随机推荐
Error [detectionnetwork (1)][warning]network compiled for 6 shapes, maximum available 10, compiling for 5 S
Fabric.js 动态设置字号大小
MSF基于SMB的信息收集
Talk about how to customize data desensitization
Kubelet error getting node help
MSF adds back door to normal program
Typescript high level feature 1 - merge type (&)
矩阵求逆操作的复杂度分析(逆矩阵的复杂度分析)
[scheme development] sphygmomanometer scheme pressure sensor sic160
Remote office related issues to be considered by enterprises
[intelligent development] scheme design and hardware development of sphygmomanometer
考研數學 【數列極限證明題】題型方法總結
Runtimeerror: blobreader error:the version of imported blob doesn't match graph_ transformer
Customize PCBA scheme and develop wrist sphygmomanometer scheme
OpenCV OAK-D-W广角相机测试
Award winning survey streamnational sponsored 2022 Apache pulsar user questionnaire
【芯片方案】红外人体测温仪方案设计
[software] ERP model selection method for large enterprises
shell脚本之sed详解 (sed命令 , sed -e , sed s/ new / old / ... )
ArcGIS 10.9.1 geological and meteorological volume metadata processing and service publishing and calling