解決從github下載web的源碼部署到eclipse的問題,githubeclipse
2015年6月2日 天氣晴
github官網:https://github.com/
以下以pdf.js作為案例說明:https://github.com/mozilla/pdf.js
1).點擊案例網站右側的Download ZIP將源碼下載下來,並解壓
注意:當然也可以通過HTTPS clone URL 及Clone in Desktop的方式把源碼下載下來,在此不做說明
2).在解壓檔案的web目錄下找到viewer.html檔案,把該檔案重新命名尾碼為.jsp的檔案。
注意:當然也可以通過查看線上demo的的源碼,並把demo源碼拷貝到對應的jsp檔案即可
3). 按部就班的把js、css檔案整合到web項目中
注意:方便起見,最好分別建一個js、css分別用來放js及css檔案
4).運行eclipse中的項目,反覆結合Googlechrome的控制台console查看報錯問題,並進行解決,直到全部錯誤消失為止
另外,上傳者也提供了一種比較好的方式來獲得代碼,下面簡單說一下
1).To get a local copy of the current code, clone it using git:
$ git clone git://github.com/mozilla/pdf.js.git$ cd pdf.js
注意:Git for Windows:http://msysgit.github.io/,直接安裝即可
2).Next, install Node.js via the official package or via nvm. If everything worked out, run
$ npm install
to install all dependencies for PDF.js.
注意:nodejs下載官網為:http://nodejs.org/,打不開的情況下可以翻牆或者時用其他網站替代。對安裝有問題,可以參考一下W3CSCHOOL.CC這個網址;對nodejs不瞭解,可以查看一下百度百科
3).Finally you need to start a local web server as some browsers do not allow opening PDF files using a file:// URL. Run
$ node make server
4).and then you can open
http://localhost:8888/web/viewer.html
It is also possible to view all test PDF files on the right side by opening
http://localhost:8888/test/pdfs/?frame
注意:找不到pdf.js這個檔案夾的時候,可以通過EveryThing這個軟體進行搜尋。EveryThing為:http://www.voidtools.com/