日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

基于DOS命令打war包

發布時間:2025/4/5 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 基于DOS命令打war包 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

基于DOS命令打war包

環境版本信息:win10 x64;Tomcat9.0



操作

  • 將javaweb項目放到磁盤中的某個位置(例如:F:\javaweb\demo,demo為javaweb項目),路徑上不可有中文字符
  • 打開命令行窗口(cmd.exe),cd切換進javaweb項目里面cd F:\javaweb\demo
  • 運行代碼jar -cvf Project_name.war ./*,其中Project_name命名隨意,但不可有中文字符cd F:\javaweb\demo>jar -cvf Project_name.war ./*
  • 成功即在窗口中顯示正在添加:……(輸入=……)(輸出=……)(壓縮了……),并在項目內自動生成war文件

  • Tomcat中部署war包

  • 啟動tomcat,進入瀏覽器localhost:8080
  • 點擊Manager App。提示輸入用戶名和密碼,點擊取消。
  • 查看401 Unauthorized(未授權)信息
  • You are not authorized to view this page. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.
    For example, to add the manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above.

    <role rolename="manager-gui"/> <user username="tomcat" password="s3cret" roles="manager-gui"/>
  • 將<role />、<user />復制到conf/tomcat-users.xml的最下面(但要在<tomcat-users> </tomcat-users里面)
  • 再次進入Manager App,將username、password信息復制到用戶名、密碼欄中,進入Manager App
  • 在WAR file to deploy部分中選擇war包,點擊部署,成功后即可在Applications部分看到對應的javaweb項目

  • 運行war包對應的javaweb項目

    瀏覽器中輸入localhost:8080/剛部署的javaweb項目名,出現頁面即表示成功部署

    總結

    以上是生活随笔為你收集整理的基于DOS命令打war包的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。