目录
0.说一下我的操作系统
Edition Windows 11 Pro for Workstations Insider Preview
Version 22H2
Installiert am 03.02.2023
Betriebssystembuild 25290.1000
Leistung Windows Feature Experience Pack 1000.25290.1000.0
1.什么是Java?
这是我在一个网站里找到的(链接放到文章尾部)
What is Java?
Java is a programming language and a platform. Java is a high level, robust, object-oriented and secure programming language.
Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Before Java, its name was Oak. Since Oak was already a registered company, so James Gosling and his team changed the name from Oak to Java.
(Platform: Any hardware or software environment in which a program runs, is known as a platform. Since Java has a runtime environment (JRE) and API, it is called a platform.
Play Video)
Application
According to Sun, 3 billion devices run Java. There are many devices where Java is currently used. Some of them are as follows:
Desktop Applications such as acrobat reader, media player, antivirus, etc.
Web Applications such as irctc.co.in, javatpoint.com, etc.
Enterprise Applications such as banking applications.
Mobile
Embedded System
Smart Card
Robotics
Games, etc.
Types of Java Applications
There are mainly 4 types of applications that can be created using Java programming:
1) Standalone Application
Standalone applications are also known as desktop applications or window-based applications. These are traditional software that we need to install on every machine. Examples of standalone application are Media player, antivirus, etc. AWT and Swing are used in Java for creating standalone applications.
2) Web Application
An application that runs on the server side and creates a dynamic page is called a web application. Currently, Servlet, JSP, Struts, Spring, Hibernate, JSF, etc. technologies are used for creating web applications in Java.
3) Enterprise Application
An application that is distributed in nature, such as banking applications, etc. is called an enterprise application. It has advantages like high-level security, load balancing, and clustering. In Java, EJB is used for creating enterprise applications.
4) Mobile Application
An application which is created for mobile devices is called a mobile application. Currently, Android and Java ME are used for creating mobile applications.
(刚刚是无脑复制qwq)
2.Java的环境配置
2.1Java JDK下载
跳转到这个链接:Java Downloads | Oracle Deutschland
向下拉
点击Windows
点击x64 MSI Installer,等待下载完成
2.2安装 Java JDK
打开你的下载目录,我的是Downloads,所以是这样
点击第一个安装包
点击Next
可以点击Change,切换安装目录,也可默认,Next
在这个之前会有管理员授权
这个就是安装完毕了,点击Close
2.3添加环境变量
切换你安装的目录
到bin并复制文件位置
Strg+C(或Ctrl + c),复制成功!
进入设置
下拉,进入Info(最后一个选项)
点击Erweiterte Systemeinstellungen
点击Umgebungsvariablen...
双击lufth(用户名)的path
点击Neu并把刚刚复制的链接粘贴进去,然后一直OK
2.4测试是否安装成功
打开Powershell or cmd
输入
java --version
安装成功,会输出
java 19.0.2 2023-01-17
Java(TM) SE Runtime Environment (build 19.0.2+7-44)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.2+7-44, mixed mode, sharing)
(版本号不同,内容不同)
2.5实验程序(Hello World)
1、打开代码编辑器(我用的是Vim)
输入这个命令
vi test.java
点击Insert
输入
ublic class HelloWorld {
/* 第一个Java程序
* 它将输出字符串 Hello World
*/
public static void main(String[] args) {
System.out.println("Hello World"); // 输出 Hello World
}
}
这个程序相当于C&C++的这个
// C++
#include<bits/stdc++.h>
using namespace std;
int main(){
cout << "Hello World";
return 0;
}
//C
#include<stdio.h>
int main(int argc, char **argv){
printf("Hello, World");
return 0;
}
里面的要点就都在这个图片里面了
3.前文的链接
第一个介绍:Java Tutorial | Learn Java Programming - javatpoint
第二个图片:Java 教程 | 菜鸟教程 (runoob.com)
债见