当前位置:网站首页>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

边栏推荐
- Complexity analysis of matrix inversion operation (complexity analysis of inverse matrix)
- Error [error] input tesnor exceeded available data range [neuralnetwork (3)] [error] input tensor '0' (0)
- The mobile terminal page uses REM for adaptation
- 机器学习笔记 - 深度学习技巧备忘清单
- 20. valid brackets
- 1493. the longest subarray with all 1 after deleting an element
- 剑指 Offer II 041. 滑动窗口的平均值
- Some learning records I=
- PD chip ga670-10 for OTG while charging
- openstack详解(二十四)——Neutron服务注册
猜你喜欢

Openstack explanation (24) -- registration of neutron service

MSF基于SMB的信息收集

Résumé de la méthode d'examen des mathématiques

Output image is bigger (1228800b) than maximum frame size specified in properties (1048576b)

PD chip ga670-10 for OTG while charging

Console you don't know

Use of MSF evaluation module

Talk about how to customize data desensitization

ArcGIS 10.9.1 geological and meteorological volume metadata processing and service publishing and calling

ArcGIS 10.9.1 地质、气象体元数据处理及服务发布调用
随机推荐
Install jupyter in the specified environment
面试题 17.10. 主要元素
[237. delete nodes in the linked list]
shell脚本之sed详解 (sed命令 , sed -e , sed s/ new / old / ... )
Sword finger offer 06 Print linked list from end to end
[image processing] spatial domain image enhancement
基于SIC32F911RET6设计的腕式血压计方案
实现边充边OTG的PD芯片GA670-10
[C language - function stack frame] analyze the whole process of function call from the perspective of disassembly
Sword finger offer 31 Stack push and pop sequence
Comparison and introduction of OpenCV oak cameras
[scheme development] sphygmomanometer scheme pressure sensor sic160
Bowen dry goods | Apache inlong uses Apache pulsar to create data warehousing
When the enterprise makes a decision, which part should lead the ERP project?
2161. divide the array according to the given number
企业决议时,哪个部分应该主导ERP项目?
Pytorch installation for getting started with deep learning
市场上的服装ERP体系到底是哪些类型?
Video review pulsar summit Asia 2021, cases, operation and maintenance, ecological dry goods
Type-C Bluetooth speaker single port rechargeable OTG solution