如何在Eclipse或者Myeclipse中使用tomcat(配置tomcat,發布web項目)?(圖文詳解)(很實用)


 

 

 

 

 

  前期博客

Eclipse里的Java EE視圖在哪里?MyEclipse里的Java EE視圖在哪里?MyEclipse里的MyEclipse Java Enterprise視圖在哪里?(圖文詳解)

 

 

 

 

 

 如何在Myeclipse中使用tomcat(配置tomcat,發布web項目)?

   首先,打開MyEclipse,點擊菜單欄中 window–>preference –>Myeclipse –>servers->tomcat(也可以window-preference –>搜索tomcat)
選擇你自己需要的tomcat (我的是tomcat 7.x)前提是你已經有自己解壓好的tomcat。

  

  大家,還沒有在本地里安裝好tomcat的博友,請移步

Tomcat *的安裝和運行(綠色版和安裝版都適用)

   更多深入學習tomcat的話,在我博客主頁的分類里,見如下

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

   然后, 在tomcat 7.x 中配置 你自己的tomcat路徑信息 (如我這里是D:\SoftWare\apache-tomcat-7.0.69)

 

   

 

   然后,然后配置相應的tomcat 7.x 下的jdk,點擊add, 然后找到自己的jdk的目錄,然后點擊apply

 

 

   這是我本地的

 

 

 

 

 

   然后,再返回tomcat 7.x 頁面 ,選擇enable,點擊Apply

 

 

 

   最后,選擇MYEclipse的 tomcat 4.x ,選擇disable,點擊OK 即可

 

 

   接着,來

如何發布MyEclipse中的web項目

 

   首先,創建好自己的Web工程后,點擊如圖下所示圖標:

 

 

 

 

 

   然后,在Project下選擇要發布的工程名稱

 

 

 

 

   然后點擊右側的 add 按鈕

 

 

 

 

   在 Server 下選擇自己的Tomcat (Tomcat 7.x)

 

 

 

 

 

 

 

 

 

 

 

   然后,點擊finish 后,點擊OK,下方消息框出現下圖,則是發布成功 

 

 

 

 

 

  然后,選中你所創建的web項目->單擊右鍵->選擇run as->MyEclipse Server Application->在彈出的對話框中選擇任意一個都可以->ok

 

 

 

 

 

 

 

 

   以下分為在本地(如我的win7系統里安裝的Tomcat 7.x ),或者大家也可以用MyEclipse自帶的MyEclipse Tomcat

 方式一: 本地(如我的win7系統里安裝的Tomcat 7.x )

 

 

 

  或者這樣來操作,也是可以的

 

 

 

 

 

 

 

 

 

 

 

七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version:        Apache Tomcat/7.0.69
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built:          Apr 11 2016 07:57:09 UTC
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number:         7.0.69.0
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name:               Windows 7
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version:            6.1
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture:          amd64
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home:             C:\Program Files\Java\jdk1.7.0_51\jre
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version:           1.7.0_51-b13
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor:            Oracle Corporation
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE:         D:\SoftWare\apache-tomcat-7.0.69
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME:         D:\SoftWare\apache-tomcat-7.0.69
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\SoftWare\apache-tomcat-7.0.69
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=D:\SoftWare\apache-tomcat-7.0.69
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\SoftWare\apache-tomcat-7.0.69/common/endorsed
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.io.tmpdir=D:\SoftWare\apache-tomcat-7.0.69\temp
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;D:\SoftWare\apache-tomcat-7.0.69\bin
七月 29, 2017 2:44:06 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dsun.io.useCanonCaches=false
七月 29, 2017 2:44:06 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
七月 29, 2017 2:44:06 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
七月 29, 2017 2:44:07 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.1m 19 Mar 2015)
七月 29, 2017 2:44:07 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
七月 29, 2017 2:44:07 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
七月 29, 2017 2:44:07 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3317 ms
七月 29, 2017 2:44:08 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
七月 29, 2017 2:44:08 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.69
七月 29, 2017 2:44:08 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\docs
七月 29, 2017 2:44:08 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\docs has finished in 139 ms
七月 29, 2017 2:44:08 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\examples
七月 29, 2017 2:44:11 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
七月 29, 2017 2:44:11 下午 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
七月 29, 2017 2:44:11 下午 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@401eea7c')
七月 29, 2017 2:44:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\examples has finished in 2,209 ms
七月 29, 2017 2:44:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\host-manager
七月 29, 2017 2:44:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\host-manager has finished in 321 ms
七月 29, 2017 2:44:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\manager
七月 29, 2017 2:44:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\manager has finished in 294 ms
七月 29, 2017 2:44:11 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\ROOT
七月 29, 2017 2:44:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\ROOT has finished in 431 ms
七月 29, 2017 2:44:12 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\sport-web
七月 29, 2017 2:44:25 下午 org.apache.catalina.startup.TldConfig execute
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
七月 29, 2017 2:44:25 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
七月 29, 2017 2:44:25 下午 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deployment of web application directory D:\SoftWare\apache-tomcat-7.0.69\webapps\sport-web has finished in 13,772 ms
七月 29, 2017 2:44:25 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
七月 29, 2017 2:44:25 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
七月 29, 2017 2:44:25 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 18020 ms

 

 

   

http://localhost:8080/***

 

   貼圖

 

 

 

 

方式二、MyEclipse自帶的MyEclipse Tomcat

 

 

 

   貼圖

 

 

 

   注意:別忘記,還需在

D:\Code\MyEclipseHadoopCode\***\WebRoot

  ***是項目名

  我的項目編寫的代碼是在D:\Code\MyEclipseHadoopCode\***\

 

 

 

 

 

 

 

 

 

 

 

如何在Eclipse中使用tomcat(配置tomcat,發布web項目)?

 

   直接

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  來到如下界面,在左邊選擇你需要的項目,雙擊,添加到右邊,然后完成即可。

 

 

 

 

 

 

 

 

 

 

 

  接着,來

  如何發布Eclipse中的web項目

   直到這里,你的server中就有你的項目了

 

 

 

 

 

   然后,鼠標選中你剛剛添加的server,右鍵啟動

 

 

 

 

 

 

 

 

 

七月 29, 2017 3:22:34 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin
警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:PJT' did not find a matching property.
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server version:        Apache Tomcat/7.0.69
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server built:          Apr 11 2016 07:57:09 UTC
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Server number:         7.0.69.0
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Name:               Windows 7
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: OS Version:            6.1
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Architecture:          amd64
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Java Home:             C:\Program Files\Java\jdk1.7.0_51\jre
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Version:           1.7.0_51-b13
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: JVM Vendor:            Oracle Corporation
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_BASE:         D:\Code\eclipseMarsCode\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: CATALINA_HOME:         D:\SoftWare\apache-tomcat-7.0.69
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.base=D:\Code\eclipseMarsCode\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dcatalina.home=D:\SoftWare\apache-tomcat-7.0.69
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dwtp.deploy=D:\Code\eclipseMarsCode\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Djava.endorsed.dirs=D:\SoftWare\apache-tomcat-7.0.69\endorsed
七月 29, 2017 3:22:34 下午 org.apache.catalina.startup.VersionLoggerListener log
信息: Command line argument: -Dfile.encoding=GBK
七月 29, 2017 3:22:34 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.1.
七月 29, 2017 3:22:34 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
七月 29, 2017 3:22:35 下午 org.apache.catalina.core.AprLifecycleListener initializeSSL
信息: OpenSSL successfully initialized (OpenSSL 1.0.1m 19 Mar 2015)
七月 29, 2017 3:22:35 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-apr-8080"]
七月 29, 2017 3:22:36 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
七月 29, 2017 3:22:36 下午 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3032 ms
七月 29, 2017 3:22:36 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Catalina
七月 29, 2017 3:22:36 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.69
七月 29, 2017 3:22:51 下午 org.apache.catalina.startup.TldConfig execute
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
七月 29, 2017 3:22:51 下午 org.apache.catalina.core.ApplicationContext log
信息: No Spring WebApplicationInitializer types detected on classpath
七月 29, 2017 3:22:51 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-apr-8080"]
七月 29, 2017 3:22:51 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-apr-8009"]
七月 29, 2017 3:22:51 下午 org.apache.catalina.startup.Catalina start
信息: Server startup in 15439 ms

 

 

 

 

   啟動成功后再到瀏覽器中輸入:http://localhost:8080/***  。回車,如果不出錯的話應該應該就能顯示出的默認頁面了。

 

 

 

 

 

 

 

 

 

  參考

http://jingyan.baidu.com/article/d8072ac4641c19ec94cefd7b.html(MyEclipse怎樣部署WEB程序)

Servlet開發(一)如何在Myeclipse 中使用tomcat(配置tomcat,發布web項目)

 http://jingyan.baidu.com/article/a501d80c0c65baec630f5ef6.html(如何用tomcat發布自己的Java項目)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM