用javac編譯整個j2ee項目

來源:互聯網
上載者:User

標籤:

轉自:http://www.blogjava.net/zhyiwww/archive/2011/10/13/361145.html

 

我們做項目,可能會使用ant做系統整合和部署。其實ant在編譯項目時歸根結底也用的是javac命令。
我們能否用javac直接編譯大型項目呢?是可以的。

以項目Sample為例予以說明如下。如果j2ee項目sample放在/tmp/下
【1】cd /tmp/sample
進入項目目錄,以便進行下面的操作
【2】find src -name *.java > sources.list
產生需要編譯的檔案清單,如下:

  1 src/com/tt/dom/SeityOficer.java
  2 src/com/tt/dom/UsisitOffrProxy.java
  3 src/com/tt/dom/LoginCheckServer.java
  4 src/com/tt/dom/LoginOfficer.java
  5 src/com/tt/dom/SecurProxy.java
  6 src/com/tt/dom/Operaxy.java
  7 src/com/tt/dom/LoginrProxy.java
  8 src/com/tt/dom/LoginOfficerProxy.java
  9 src/com/tt/dom/UserOfficerProxy.java
 10 src/com/tt/dom/UserMap.java【3】編譯,執行下面的命令

javac  -classpath /opt/jdk1.6.0_18/lib/  -d /tmp  -extdirs /opt/apache-tomcat-6.0.20/lib/:WebRoot/WEB-INF/lib/  @sources.list

【4】會在/tmp/目錄下產生對應的class檔案。

用javac編譯整個j2ee項目

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.