当前位置:网站首页>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?
- Why is it difficult to implement informatization in manufacturing industry?
- Some learning records I=
- [237. delete nodes in the linked list]
- Opencv CEO teaches you to use oak (V): anti deception face recognition system based on oak-d and depthai
- 1721. exchange nodes in the linked list
- 机器学习笔记 - 卷积神经网络备忘清单
- Sword finger offer II 041 Average value of sliding window
- Machine learning notes - in depth Learning Skills Checklist
- Version mismatch between installed deeply lib and the required one by the script
猜你喜欢

Openstack explanation (XXIII) -- other configurations, database initialization and service startup of neutron

Bowen dry goods | Apache inlong uses Apache pulsar to create data warehousing
![[C language - function stack frame] analyze the whole process of function call from the perspective of disassembly](/img/c5/40ea5571f187e525b2310812ff2af8.png)
[C language - function stack frame] analyze the whole process of function call from the perspective of disassembly

Sed explanation of shell script (SED command, sed -e, sed s/ new / old /...)

Typescript high level feature 1 - merge type (&)

Pulsar job Plaza | Tencent, Huawei cloud, shrimp skin, Zhong'an insurance, streamnational and other hot jobs

OpenCV CEO教你用OAK(五):基于OAK-D和DepthAI的反欺骗人脸识别系统

CUMT learning diary - theoretical analysis of uCOSII - Textbook of Renzhe Edition

Comparison and introduction of OpenCV oak cameras

openstack详解(二十一)——Neutron组件安装与配置
随机推荐
Openstack explanation (21) -- installation and configuration of neutron components
Type-C扩展坞自适应供电专利维权案例
1400. 构造 K 个回文字符串
从企业评价的方历来看ERP软件成功与失利
Fabric.js 動態設置字號大小
Comparison and introduction of OpenCV oak cameras
What problems can ERP system help enterprises deal with?
[intelligent development] scheme design and hardware development of sphygmomanometer
openstack详解(二十三)——Neutron其他配置、数据库初始化与服务启动
ERP体系的这些优势,你知道吗?
OpenCV CEO教你用OAK(五):基于OAK-D和DepthAI的反欺骗人脸识别系统
206. reverse linked list
Machine learning notes - in depth Learning Skills Checklist
机器学习笔记 - 使用TensorFlow的Spatial Transformer网络
Opencv CEO teaches you to use oak (IV): create complex pipelines
【分享】企业如何进行施行规划?
Success and failure of ERP software from the perspective of enterprise evaluation
山东大学增强现实实验四
报错[DetectionNetwork(1)][warning]Network compiled for 6 shaves,maximum available 10,compiling for 5 s
Install jupyter in the specified environment