java-thrift運行DEMO

來源:互聯網
上載者:User

通過閱讀~/thrift-0.8.0/tutorial/java/README,知道需要首先安裝ant,這是一種java的編譯部署工具,類似C裡的make

sudo apt-get install ant

提示警告:warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds ,網上的解決方案說需要修改build.xml,為javac節點添加屬性 includeantruntime="on" 

<target name="compile" depends="init">    <javac srcdir="${gen}" destdir="${build}" classpathref="libs.classpath" includeantruntime="on" />    <javac srcdir="${src}" destdir="${build}" classpathref="build.classpath" includeantruntime="on" /></target>

然後執行ant命令,提示錯誤沒有thrift-0.8.0/lib/java/build/目錄,所以但是有thrift-0.8.0/lib/java/目錄,於是cd進來,發現還有個README檔案,裡面說需要在該目錄下執行ant命令

cd ~/thrift-0.8.0/lib/java/ant

命令執行過程中會到外部網站下載一個jar檔案,需要等一段時間,之後產生了thrift-0.8.0/lib/java/build/目錄,並在該目錄下產生一堆庫檔案,回到~/thrift-0.8.0/tutorial/java/再次執行ant,命令,這次順利產生一個build目錄

cd ~/thrift-0.8.0/tutorial/javaant./JavaServer #啟動java伺服器監聽9090連接埠cd ~/thrift-0.8.0/tutorial/py./PythonClient.py #開啟另一個shell視窗,使用python的用戶端和java的伺服器通訊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.