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

边栏推荐
- Device = depthai Device(““, False) TypeError: _init_(): incompatible constructor arguments.
- Sword finger offer 18 Delete the node of the linked list
- What are the types of garment ERP system in the market?
- 【软件】ERP体系价值最大化的十点技巧
- 【方案开发】血压计方案压力传感器SIC160
- ArcGIS 10.9.1 geological and meteorological volume metadata processing and service publishing and calling
- 报错Version mismatch between installed depthai lib and the required one by the scrip.
- 剑指 Offer 18. 删除链表的节点
- Erreur de démarrage MySQL "BIND on TCP / IP Port: Address already in use"
- Exclusive interview with PMC member Liu Yu: female leadership in Apache pulsar community
猜你喜欢

MSF基于SMB的信息收集

Openstack explanation (24) -- registration of neutron service

Machine learning notes - convolutional neural network memo list

考研數學 【數列極限證明題】題型方法總結

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

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

Opencv CEO teaches you to use oak (V): anti deception face recognition system based on oak-d and depthai

Use of MSF evaluation module

Console you don't know

Machine learning notes - in depth Learning Skills Checklist
随机推荐
Exclusive interview with PMC member Liu Yu: female leadership in Apache pulsar community
Type-C docking station adaptive power supply patent protection case
206. reverse linked list
Comment l'entreprise planifie - t - elle la mise en oeuvre?
报错[error] input tesnor exceeds available data range [NeuralNetwork(3)] [error] Input tensor ‘0‘ (0)
【软件】大企业ERP选型的方法
Pulsar job Plaza | Tencent, Huawei cloud, shrimp skin, Zhong'an insurance, streamnational and other hot jobs
openstack详解(二十二)——Neutron插件配置
2130. maximum twin sum of linked list
682. baseball game
ERP体系能帮忙企业处理哪些难题?
服装ERP:企业如何进行施行规划?
[software] ERP model selection method for large enterprises
Interview question 02.02 Return the penultimate node
1721. exchange nodes in the linked list
市场上的服装ERP体系到底是哪些类型?
[237. delete nodes in the linked list]
考研數學 【數列極限證明題】題型方法總結
Machine learning notes - spatial transformer network using tensorflow
How win10 Home Edition connects to remote desktop