JavaWeb开发环境

1、JDK

  • 使用javac编译(例:javac HelloWorld.java),使用java运行(例:java HelloWorld)
    代码:
    public class HelloWorld {
    public static void main(String[] args) {

      System.out.println("你好,世界");

    }
    }

    (1)将如上代码复制粘贴到记事本里面,保存文件为H.java

    (2)选择特定JDK编译,

    (3)进入C盘 C:

    (4)进入JDK bin目录

    cd C:\Program Files\Java\jdk1.8.0_212\bin

    (5)编译

    javac.exe -encoding UTF-8 -d [生成class根目录] [要编译的java文件路径]

    (6)运行

    java.exe -classpath [class根目录] [类名]

    (7)如图所示:

    image.png

    2、tomcat访问(默认端口8080)

    (1)双击startup.bat运行

    image.png

    (2)浏览器访问:http://localhost:8080

    image.png

    3、nginx访问(默认端口80)

    (1)双击nginx.bat运行

    image.png
    image.png

    (2)访问http://localhost:80

    image.png
    当打开时,访问别人的电脑时只需要输入别人电脑的IP(查IP cmd ipconfig -all
    :http默认端口80,https默认端口443。


曦夏
7 声望3 粉丝