个人工具

“UbuntuHelp:EclipseIDE”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/EclipseIDE}}
 
{{From|https://help.ubuntu.com/community/EclipseIDE}}
{{Languages|php5}}
+
{{Languages|UbuntuHelp:EclipseIDE}}
 
Parent page: [[UbuntuHelp:Programming| Programming Applications]]
 
Parent page: [[UbuntuHelp:Programming| Programming Applications]]
  
第68行: 第68行:
 
* Create <code><nowiki>/usr/bin/eclipse</nowiki></code> with your favorite text editor (e.g <code><nowiki>sudo vi /usr/bin/eclipse</nowiki></code>) and add the following content:
 
* Create <code><nowiki>/usr/bin/eclipse</nowiki></code> with your favorite text editor (e.g <code><nowiki>sudo vi /usr/bin/eclipse</nowiki></code>) and add the following content:
 
<pre><nowiki>
 
<pre><nowiki>
#!/bin/sh
 
 
export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
 
export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
 
export ECLIPSE_HOME="/opt/eclipse"
 
export ECLIPSE_HOME="/opt/eclipse"
第122行: 第121行:
 
* Create <code><nowiki>~/bin/eclipse</nowiki></code> with your favorite text editor (e.g <code><nowiki>vi ~/bin/eclipse</nowiki></code>) and add the following content:
 
* Create <code><nowiki>~/bin/eclipse</nowiki></code> with your favorite text editor (e.g <code><nowiki>vi ~/bin/eclipse</nowiki></code>) and add the following content:
 
<pre><nowiki>
 
<pre><nowiki>
#!/bin/sh
 
 
export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
 
export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
 
export ECLIPSE_HOME="$HOME/opt/eclipse"
 
export ECLIPSE_HOME="$HOME/opt/eclipse"
第148行: 第146行:
 
* Edit <code><nowiki>/usr/bin/eclipse</nowiki></code> with a text editor (e.g <code><nowiki>sudo gedit /usr/bin/eclipse</nowiki></code>) and change the content to the following:
 
* Edit <code><nowiki>/usr/bin/eclipse</nowiki></code> with a text editor (e.g <code><nowiki>sudo gedit /usr/bin/eclipse</nowiki></code>) and change the content to the following:
 
<pre><nowiki>
 
<pre><nowiki>
#!/bin/sh
 
  
# Eclipse startup script
 
# JPackage Project <http://www.jpackage.org/>
 
# $Id$
 
  
 
ECLIPSE_OPTS=""
 
ECLIPSE_OPTS=""
 
VM_OPTS=""
 
VM_OPTS=""
  
# Source system prefs
 
 
if [ -r /etc/eclipse.conf ] ; then
 
if [ -r /etc/eclipse.conf ] ; then
 
   . /etc/eclipse.conf
 
   . /etc/eclipse.conf
 
fi
 
fi
  
# Source user prefs
 
 
if [ -r $HOME/.eclipserc ] ; then
 
if [ -r $HOME/.eclipserc ] ; then
 
   . $HOME/.eclipserc
 
   . $HOME/.eclipserc
 
fi
 
fi
  
# Set data dir if -data wasn't given.
 
 
if ! echo $@ | grep '\-data ' >/dev/null 2>&1 && [ -n "$USER_DIR" ]; then
 
if ! echo $@ | grep '\-data ' >/dev/null 2>&1 && [ -n "$USER_DIR" ]; then
 
   ECLIPSE_OPTS="$ECLIPSE_OPTS -data $USER_DIR"
 
   ECLIPSE_OPTS="$ECLIPSE_OPTS -data $USER_DIR"
 
fi
 
fi
  
# Find our JVM.
 
# if [ ! -x "$JAVACMD" -a -r /usr/share/java-utils/java-functions ]; then
 
#  . /usr/share/java-utils/java-functions
 
#  set_javacmd
 
# fi
 
  
 
JAVACMD="/usr/lib/j2re1.5-sun/bin/java"
 
JAVACMD="/usr/lib/j2re1.5-sun/bin/java"
  
# Set JVM if -vm wasn't given.
 
 
if ! echo $@ | grep '\-vm ' >/dev/null 2>&1 && [ -n "$JAVACMD" ]; then
 
if ! echo $@ | grep '\-vm ' >/dev/null 2>&1 && [ -n "$JAVACMD" ]; then
 
   ECLIPSE_OPTS="$ECLIPSE_OPTS -vm $JAVACMD"
 
   ECLIPSE_OPTS="$ECLIPSE_OPTS -vm $JAVACMD"
 
fi
 
fi
  
# Set JVM args if -vmargs wasn't given.  This needs to be the last option.
 
 
if ! echo $@ | grep '\-vmargs ' >/dev/null 2>&1 && [ -n "$VM_ARGS" ]; then
 
if ! echo $@ | grep '\-vmargs ' >/dev/null 2>&1 && [ -n "$VM_ARGS" ]; then
 
   VM_OPTS="-vmargs $VM_ARGS"
 
   VM_OPTS="-vmargs $VM_ARGS"
 
fi
 
fi
  
# if [ -w $USER_DIR/.metadata/.config/platform.cfg ]; then
 
#  perl -p -i.bak -e 's|^site\.[0-9]*\.list\.[0-9]*=.*\n||g;' $USER_DIR/.metadata/.config/platform.cfg
 
# fi
 
  
 
/opt/eclipse/eclipse $ECLIPSE_OPTS $@ $VM_OPTS
 
/opt/eclipse/eclipse $ECLIPSE_OPTS $@ $VM_OPTS
第200行: 第181行:
  
 
----
 
----
CategoryDocumentation
+
[[category:CategoryDocumentation]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年5月14日 (一) 11:13的版本

Parent page: Programming Applications


Eclipse in Breezy

Eclipse download & installation

Install the eclipse-jdt package.

The Help system is currently unavailable within Eclipse.

If you have problems using the PyDev plugin, try installing Sun Java (see RestrictedFormats) and editing /etc/eclipse/java_home to include the path /usr/lib/jvm/java-1.5.0-sun (for dapper). You may also enjoy a speed up after doing that.

Eclipse and Sun Java

By default, the eclipse which is packaged with Breezy runs with the GCJ JVM and not the JVM supplied by Sun Microsystems even if you have installed the Sun version (sun-java5 packages from the Multiverse repository). In order to load eclipse with the Sun JVM, edit the /etc/eclipse/java_home file and add the path of the Sun JVM (its usually /usr/lib/jvm/java-1.5.0-sun) on the first line. Ensure that the change has happened by looking at the Configuration details from the About menu item in Eclipse.

Even after setting up Eclipse to use the Sun JVM, it will by default use GCJ JRE for compiling projects. To change this JRE, goto Window->Preferences->Java->Installed JREs from inside Eclipse and make it point to the Sun JRE.

Java3d

Java3d is now supported for use with Eclipse on Ubuntu, see Java3dUbuntu.

Troubleshooting

Installing plugins (ie CDT)

To install plugins for eclipse in Ubuntu (ie CDT), start Eclipse as root and install the plugins via the Eclipse update manager.

gksudo eclipse
Plugins not working properly

Some plugins do not seem to function properly when running Eclipse normally, such as BIRT. Running Eclipse with the following options may fix the plugin:

eclipse -vm $JAVA_HOME/bin/java -ws gtk

Eclipse before Breezy

Eclipse download

Go to the nearest eclipse mirror and download eclipse-platform-3.1.2-linux-gtk.zip. If you want to code in Java, you can download eclipse-SDK-3.1.2-linux-gtk.zip instead or install it afterwards.

Eclipse installation

Java Implementation

Eclipse may not be fully operational when used with free Java implementations. If you encounter problems with Eclipse after install, you may require Sun's non-free implementation to get Eclipse working properly. See instructions here: UbuntuHelp:Java, but be sure to consider legal issues as well: RestrictedFormats.

Global installation

Use this method if you want Eclipse to be available for all users, or if you are the only user of the computer.

Eclipse
  • Unzip eclipse in /opt:
$ sudo unzip eclipse-SDK-3.1.2-linux-gtk.zip -d /opt
  • Change the owner to root:
$ sudo chown -R root:root /opt/eclipse/
  • Create /usr/bin/eclipse with your favorite text editor (e.g sudo vi /usr/bin/eclipse) and add the following content:
export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/opt/eclipse"

$ECLIPSE_HOME/eclipse $*
  • Finally, allow the script to be executed:
$ sudo chmod +x /usr/bin/eclipse
Gnome icon
  • Create a new launcher on the desktop (right click on the desktop -> Create Launcher) or on a panel (right click on a panel -> Add to Panel -> Custom Application Launcher) and add the following data:
    • Name: Eclipse Platform
    • Command: eclipse
    • Icon: /opt/eclipse/icon.xpm

If you want an icon in the Applications Menu:

  • Create a new launcher called eclipse.desktop in /usr/share/applications with your favorite text editor (e.g sudo vi /usr/share/applications/eclipse.desktop) and add the following content:
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse Platform
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
User installation

Use this method if you want Eclipse available only for yourself, or if you haven't got root access to the computer.

Eclipse
  • Make an opt folder in your home directory:
$ mkdir ~/opt
  • Unzip eclipse in the opt folder:
$ unzip eclipse-platform-3.1.2-linux-gtk.zip -d ~/opt
  • Make a bin folder in your home directory, this will be used for the startup script:
$ mkdir ~/bin
  • Create ~/bin/eclipse with your favorite text editor (e.g vi ~/bin/eclipse) and add the following content:
export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="$HOME/opt/eclipse"

$ECLIPSE_HOME/eclipse $*
  • Finally, allow the script to be executed:
$ chmod +x ~/bin/eclipse
Gnome icon
  • Create a new launcher on the desktop (right click on the desktop -> Create Launcher) or on a panel (right click on a panel -> Add to Panel -> Custom Application Launcher)
    • Name: Eclipse Platform
    • Command: /home/<your username>/bin/eclipse
    • Icon: /home/<your username>/opt/eclipse/icon.xpm

Troubleshooting

If the following error is encountered when running eclipse from the launcher:

The Eclipse executable launcher was unable to locate its companion startup.jar file (in the same directory as the executable)
  • Edit /usr/bin/eclipse with a text editor (e.g sudo gedit /usr/bin/eclipse) and change the content to the following:


ECLIPSE_OPTS=""
VM_OPTS=""

if [ -r /etc/eclipse.conf ] ; then
  . /etc/eclipse.conf
fi

if [ -r $HOME/.eclipserc ] ; then
  . $HOME/.eclipserc
fi

if ! echo $@ | grep '\-data ' >/dev/null 2>&1 && [ -n "$USER_DIR" ]; then
  ECLIPSE_OPTS="$ECLIPSE_OPTS -data $USER_DIR"
fi


JAVACMD="/usr/lib/j2re1.5-sun/bin/java"

if ! echo $@ | grep '\-vm ' >/dev/null 2>&1 && [ -n "$JAVACMD" ]; then
  ECLIPSE_OPTS="$ECLIPSE_OPTS -vm $JAVACMD"
fi

if ! echo $@ | grep '\-vmargs ' >/dev/null 2>&1 && [ -n "$VM_ARGS" ]; then
  VM_OPTS="-vmargs $VM_ARGS"
fi


/opt/eclipse/eclipse $ECLIPSE_OPTS $@ $VM_OPTS