輕鬆解決Linux安裝Eclipse方法

來源:互聯網
上載者:User

標籤:

隨著Linux的發展,很多人開始學習Linux系統,你瞭解Linux系統嗎?你是Linux系統的應用者嗎?本文為你詳細介紹Linux安裝Eclipse,為你在學習Linux安裝Eclipse時起一定的作用。以下是Linux安裝Eclipse完全攻略。

1. ubuntu 下安裝Eclipse
1.1 在Ubuntu搭建java開發環境
(1)安裝好Ubuntu系統;安裝的時候強烈建議串連上網,它會自動下載語言套件,自動裝上五筆,拼 音,還有會預設把firefox瀏覽器設定為中文.
(2)配置Ubuntu環境:添加源,更新軟體資訊,升級核心
可以參考網上的一篇文章:
http://hi.baidu.com/myownroom/blog/category/Linux
$ sudo apt-get update
(3)安裝jdk軟體包
sudo apt-get install sun-java6-jdk
大約過了二十分鐘會提示安裝jdk成功資訊,這時候你可以在shell打入java或javac看一看,看一下顯示的資訊有顯示(這裡顯示的是jdk版本號碼,如果系統內建的有gdk,需要注意一下),證明jdk安裝成功.
(正在設定 sun-java6-jre 不動了……
怎麼辦?\"確定\"選項明明就在,但是狂按斷行符號沒反應……
網上一查,按tab鍵,\"確定\"變紅,再按斷行符號,ok了)
接下來的工作是,配置JRE環境:
在shell執行:
sudo update-alternatives --config java
通常會給出兩個或兩個以上選擇的路徑
選擇:/usr/lib/jvm/java-1.6.0-sun/jre/bin/java作為你的JRE
(4)建議安裝安裝瀏覽器Java外掛程式(不是必要的):
在shell中執行:
sudo apt-get install sun-java6-plugin
1.2 在ubuntu下安裝eclipse。
(1)到http://www.eclipse.org/downloads/,下載eclipse for linux版本,我下載後檔案的完整名稱為:
eclipse-java-galileo-SR1-linux-gtk.tar.gz
解壓縮後,可以查看根目錄下的
(2)將eclipse-SDK-3.2.1-linux-gtk.tar.gz這一個檔案放到/opt目錄下面(用root執行mv _ _語句才能移進opt檔案夾)
(3)在shell中進入/opt/,執行: tar -zxvf eclipse-SDK-4.2.1-linux-gtk.tar.gz語句,解壓縮下載檔案
(4)在shell中,進入到eclipse 目錄,cd /opt/eclipse
設定檔案eclipse執行權:chown -R root:你的使用者名稱 eclipse
(5)建立案頭串連
sudo gedit /usr/share/applications/eclipse.desktop
加入下面內容
[Desktop Entry] Encoding=UTF-8 Name=Eclipse Comment=Eclipse SDK Exec=/opt/eclipse/eclipse Icon=/opt/eclipse/icon.xpm Terminal=false Type=Application Categories=Application;Development;
這時就會在最左上方的應用程式菜單加多一個\"編程\"-->\"eclipse\"的菜單,點擊即可起動eclipse.
提示:如果點擊\"編程\"-->\"eclipse\"的菜單提示編碼錯誤,就在案頭上自己建一個啟動器指向eclipse安裝目錄即可..
參考網址:http://www.javaeye.com/topic/34636

2. Redhat 下安裝Eclipse
參考:
(1)http://collonn.javaeye.com/blog/436427
(2)http://hi.baidu.com/summerytyj/blog/item/58ca9801b 4cb78d3267fb579.html
RedHat上安裝jdk
第一步:如果原來機子上安裝的有RedHat,需要首先卸載RedHat內建的JDK。因為版本比較新的eclipse可能需要比較新的jdk版本。
rpm -qa | grep gcj
#會列出一些東西如:java-1.4.2-gcj-compat-1.4.2.0-27jpp等,我們只刪除含有java字串的軟體包
rpm -e java-1.4.2-gcj-compat-1.4.2.0-27jpp
#或者:rpm -e --nodeps java 也可以:
但是這樣刪除的時候可能會遇到一些問題,主要是有關依賴包的問題。
這可以在Applications->Add and Remove Software中找到java開頭的包進行刪除。
第二步:安裝jdk(無論是eclipse c/c++還是eclipse java,都需要jdk)
在sun官網上下載對應作業系統的jdk。
一般有兩種格式的檔案。
第三步:安裝eclipse。
解壓電機eclipse可執行檔即可。
第四步:在案頭上添加eclipse表徵圖
(1)編寫.sh檔案
export JAVA_HOME = /usr/java/(jdk安裝資料夾)
export PATH = $JAVA_HOME/bin:$PATH
CLASSPATH=.:/usr/java/j2sdk1.4.2_01/lib/tools.jar: $CLASSPATH
export CLASSPATH
opt/eclipse/eclipse(此為eclipse解壓縮檔案所在目錄) -vm /usr/java/(jdk安裝資料夾) /bin/java -data ~/workspace &
create launch from desktop:
(1)entry derectory:/usr/share/applications/
(2)gedit eclipse.destop
[Desktop Entry] Encoding=UTF-8 Name=EclipseC++ Type=Application Terminal=false Exec=/opt/eclipseC++/eclipse -vm /opt/jdk1.6.0_16/bin/java -data ~/workspaceC++ Icon=/opt/eclipseC++/icon.xpm Categories=Apllication;Development;
(2)在案頭上按右鍵,選擇create launcher,然後選擇上述編寫的.sh檔案。這時,案頭上就會出現eclipse可執行檔。點擊即可運行。

3. 配置tomcat
第一步:
下載eclipse tomcat外掛程式:
http://www.eclipsetotale.com/tomcatPlugin.html
將該外掛程式解壓後放到eclipse的plugins目錄下。
第二步:
下載tomcat:
http://tomcat.apache.org/
重啟eclipse即可看到tomcat的表徵圖。

4. MySQL:
download address:
http://dev.mysql.com/downloads/
access denied (java.util.PropertyPermission catalina.home read
Window->Preferences-> Tomcat
Advanced->Launch Tomcat Using Sacrity Manager(don not choose)

5. MyEclipse:
download wensite:
http://www.verycd.com/topics/2741105/
ed2k://|file|[J2EE.整合式開發環境].TLF-SOFT-MyEclipse.Enterprise.Workbench.v7.1.1-R iFT.nfo|3943|1bb19755c5394a0fd8ff7592ca909d04|h=JBB AC3WAD444UT3MP2RURLNVMZXQLFEQ|/
reference:http://blog.sina.com.cn/s/blog_45fd882f0100cjsx.ht ml
have downloaded the MyEclipse , I input
$ sudo chmod 777 MyEclipse.Enterprise.Workbench.v7.1.1.LINUX.X86-Ri FT.bin
$ ./MyEclipse.Enterprise.Workbench.v7.1.1.LINUX.X86- RiFT.bin
bash: ./MyEclipse.Enterprise.Workbench.v7.1.1.LINUX.X86- RiFT.bin:無法執行二進位檔案
$ sh MyEclipse.Enterprise.Workbench.v7.1.1.LINUX.X86-Ri FT.bi n
MyEclipse.Enterprise.Workbench.v7.1.1.LINUX.X86-Ri FT.bin: 1: Syntax error: \"&\" unexpected (expecting \")\")
I do not know how to solve it,the quit.
But I still can develop web applications on eclipse.

6. Start Web Development
Reference:http://cwiki.apache.org/WW/setting-up-eclipse-with -tomcat.html

(1)Help->Install new software
->Available Software
input the website: \"http://download.eclipse.org/releases/galileo\"
choose \"WEB,XML,Java EE Development\"
the plugin can help create web applications, including JavaScript, XML, XSL, XSD, HTML, XHTML, CSS, JSP, EJBs, Webservices, and JPA tools

(2)define server:
new -> server
tomcat 5.0
(It do not support for tomcat 5.5 and 6.0, so I can just use tomcat 5.0)

(3) restart the eclipse
new-> project
input:\"web\"
choose \"Dynamic Website\"

(4) add new html to \"web \" project
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"> <html> <head> <mce:script type=\"text/javascript\"><!-- function hello(){ alert(\"hello\"); } // --></mce:script> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"> <title>Insert title here</title> </head> <body> <input type=\"text\" id=\"input1\" ></input> <br></br> <input type=\"button\" value=\"submit\" onClick=\"hello()\"></input> </body> </html>

(5) 選中web工程,按右鍵。
Run as -> Run on server
choose tomcat5.0
input website :\"http://localhost:8080/web/index.html\"
you will find you have got much seccess!

(6)add new servnet for the project:
new -> servlet,
name:helloservlet
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class for Servlet: HelloServlet * */ public class helloservlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { /* (non-Java-doc) * @see javax.servlet.http.HttpServlet#HttpServlet() */ public helloservlet() { super(); } /* (non-Java-doc) * @see javax.servlet.http.HttpServlet#doGet(HttpServletRe quest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().write(\"Hello, world!\"); } /* (non-Java-doc) * @see javax.servlet.http.HttpServlet#doPost(HttpServletR equest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } }
restart the eclipse,and run on server,
input web site:\"http://127.0.0.1:8080/web/hellowervlet\"
you will see:
Hello, world!

這樣就你學會了Linux安裝Eclipse。

輕鬆解決Linux安裝Eclipse方法

聯繫我們

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