LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
12
返回列表 发新帖
楼主: chenming2065151

lenny java 安装设置问题

[复制链接]
发表于 2009-4-18 22:13:56 | 显示全部楼层
源里面自带 eclipse 啊,装了之后肯定可用(这时你再自己装另外版本的 eclipse 也应该不会出什么问题)
回复 支持 反对

使用道具 举报

发表于 2009-4-22 11:24:30 | 显示全部楼层
就是用源里的安装的,我的装完之后启动也报楼主那样的信息。不知道为什么。请解决了的共享下解决方法哦
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-25 01:12:41 | 显示全部楼层
不好意思由于最近一直在忙考试,所以好久没有上论坛了,
我是这么解决的,首先到sun下载最新的JDK;解压后整个文件夹移到/opt中,下一步设置环境变量,
su root
gedit /etc/profile在export PATH前加入以下几行;

JAVA_HOME=/opt/jdk1.6.0_12
PATH=$JAVA_HOME/binPATH
CLASSPATH=.JAVA_HOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
export JAVA_HOME,PATH,CLASSPATH

此处 /opt/jdk1.6.0_12为我的JDK存放的路径
至于ecplise我也到官网下的压缩包,是直接解压到/opt下直接双击就能运行了;
真的非常抱歉,到现在才回复,大家多多交流,共同学习
回复 支持 反对

使用道具 举报

发表于 2009-4-29 23:58:26 | 显示全部楼层
我是这么干的
找到/usr/bin/下的eclipse文件,发现是个sh脚本有这样的东东之前是注释掉的或不完整
export JAVA_HOME
export CLASSPATH
这两句去掉注释,补充完整
export JAVA_HOME=/xxx/jdk1.5.0_12/
export CLASSPATH=/xxx/jdk1.5.0_12/jre/lib
双击该脚本,就可以运行了
后来我下了个eclipse3.4,又安装了jdk1.6发现可以这样
写一个sh脚本内容如下
eclipse -vm /xx/xx/jdk1.6.0_13/jre/bin/java
也可以,记得给脚本运行权限,eclipse目录、工作目录也要chmod一下
chmod -R 777 eclipse
chmod -R 777 /xx/yy/workspace/
回复 支持 反对

使用道具 举报

发表于 2009-4-30 00:00:17 | 显示全部楼层
告诉eclipse你的jre在哪里就可以了

啊,刚才仔细看了一下chenming2065151的方法,貌似我当时是这样弄的,就是不灵
后来才摸索出上贴的方法
难道当时敲错字母了??!!
回复 支持 反对

使用道具 举报

发表于 2009-4-30 00:21:39 | 显示全部楼层
使用vi /usr/bin/eclipse.将所有的MOZILLA_FIVE_HOME=之后的内容注释掉。然后加入:export MOZILLA_FIVE_HOME="",就可以了。我的/usr/bin/eclipse如下:
#!/bin/bash

# Having any sort of classpath causes massive breakage, with Kaffe at least.
unset CLASSPATH; export CLASSPATH

# Allow the user to specify their own Java home, we check for it later.
#unset JAVA_HOME; export JAVA_HOME

CMDLINEARGS=""
VMARGS=""
INSTALL="/usr/lib/eclipse"
STARTUP="/usr/lib/eclipse/startup.jar"

if [ -x /usr/bin/zenity ]; then
    DIALOG=/usr/bin/zenity
    DIALOGW="$DIALOG --warning"
elif [ -x /usr/bin/kdialog ]; then
    DIALOG=/usr/bin/kdialog
    DIALOGW="$DIALOG --warningyesno"
elif [ -x /usr/bin/xdialog ]; then
    DIALOG=/usr/bin/xdialog
    DIALOGW="$DIALOG --warning"
else
    DIALOG=echo
    DIALOGW="$DIALOG"
fi


# Make sure this directory exists.
if [ ! -d ~/.eclipse ]; then
    mkdir ~/.eclipse > /dev/null 2>&1
    if [ $? -ne 0 ]; then
        $DIALOG \
            --error \
            --title="Could not launch Eclipse Platform" \
            --text="Could not create settings directory at ~/.eclipse."
    fi
fi

# Just in case Eclipse tries to put something in the home directory.
cd ~

# Load default settings from the user's configuration file.
if [ -f ~/.eclipse/eclipserc ]; then
    . ~/.eclipse/eclipserc
fi

# Process the command line options. These override the eclipserc file, so we do
# them after parsing that file.
while [ "$1" ]; do
    if [ "$1" = "-h" -o "$1" = "--help" ]; then
        echo "Eclipse Starter Script"
        echo "Usage:"
        echo "eclipse [options [value]]"
        echo "See eclipse(1) for more information."
        echo ""
        echo "Also see ~/.eclipse/eclipserc, which provides some default values"
        exit 0
    elif [ "$1" = "-vm" ]; then
        shift
        unset JAVA_HOME
        JAVACMD="$1"
        shift
    elif [ "$1" = "-install" ]; then
        shift
        INSTALL="$1"
        shift
    elif [ "$1" = "-startup" ]; then
        shift
        STARTUP="$1"
        shift
    elif [ "$1" = "-vmargs" ]; then
        shift
        while [ "$1" ]; do
                VMARGS="${VMARGS} $1"
                shift
        done
    else
        CMDLINEARGS="${CMDLINEARGS} $1"
        shift
    fi
done

# If the user has specified a custom JAVA, we check it for validity.
# JAVA defines the virtual machine that Eclipse will use to launch itself.
if [ -n "${JAVA_HOME}" ]; then
    echo "using specified vm: ${JAVA_HOME}"
    if [ ! -x "${JAVA_HOME}/bin/java" ]; then
        $DIALOG \
            --error \
            --title="Could not launch Eclipse Platform" \
            --text="The custom VM you have chosen is not a valid executable."
        exit 1
    fi
fi

# If the user has not set JAVA_HOME, cycle through our list of compatible VM's
# and pick the first one that exists.
if [ -z "${JAVA_HOME}" -a ! -n "${JAVACMD}" ]; then
    echo "searching for compatible vm..."
    javahomelist=`cat /etc/eclipse/java_home  | grep -v '^#' | grep -v '^$' | while read line ; do echo -n $line ; echo -n ":" ; done`
    OFS="$IFS"
    IFS=":"
    for JAVA_HOME in $javahomelist ; do
        echo -n "  testing ${JAVA_HOME}..."
        if [ -x "${JAVA_HOME}/bin/java" ]; then
            export JAVA_HOME
            echo "found"
            break
        else
            echo "not found"
        fi
    done
    IFS="$OFS"
fi

# If we don't have a JAVA_HOME yet, we're doomed.
if [ -z "${JAVA_HOME}" -a ! -n "${JAVACMD}" ]; then
    $DIALOG \
        --error \
        --title="Could not launch Eclipse Platform" \
        --text="A suitable Java Virtual Machine for running the Eclipse Platform could not be located."
    exit 1
fi

# Set JAVACMD from JAVA_HOME
if [ -n "${JAVA_HOME}" -a -z "${JAVACMD}" ]; then
    JAVACMD="$JAVA_HOME/bin/java"
fi

# Set path for the Mozilla SWT binding
#MOZILLA_FIVE_HOME=${MOZILLA_FIVE_HOME%*/}
export MOZILLA_FIVE_HOME=""
#if false && [ -n "$MOZILLA_FIVE_HOME" -a -e $MOZILLA_FIVE_HOME/libgtkembedmoz.so ]; then
#    :
#elif [ -e /usr/lib/mozilla/libgtkembedmoz.so ]; then
#    export MOZILLA_FIVE_HOME=/usr/lib/mozilla
#elif [ -e /usr/lib/firefox/libgtkembedmoz.so ]; then
#    export MOZILLA_FIVE_HOME=/usr/lib/firefox
#elif [ -e /usr/lib/xulrunner/libgtkembedmoz.so ]; then
#    export MOZILLA_FIVE_HOME=/usr/lib/xulrunner
#elif [ -e /usr/lib/mozilla-firefox/libgtkembedmoz.so ]; then
#    export MOZILLA_FIVE_HOME=/usr/lib/mozilla-firefox
#elif [ -e /usr/lib/mozilla/libgtkembedmoz.so ]; then
#    export MOZILLA_FIVE_HOME=/usr/lib/mozilla
#else
#    $DIALOGW \
#        --title="Integrated browser support not working" \
#        --text="This Eclipse build doesn't have support for the integrated browser."
#    [ $? -eq 0 ] || exit 1
#fi

EXT=/usr/local/lib/eclipse/.eclipseextension
if [ ! -f $EXT ]; then
    if ! touch $EXT 2>/dev/null; then
        cat <<-EOF
        Could not create $EXT. Please run as root:
            touch $EXT
            chmod 2775 $EXT
            chown root:staff $EXT
        EOF
    fi
    chmod 2775 $EXT 2> /dev/null || true
    chown root:staff $EXT 2> /dev/null || true
fi

# libraries from the mozilla choosen take precedence
#LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME${LD_LIBRARY_PATH:+LD_LIBRARY_PATH}

# Do the actual launch of Eclipse with the selected VM.
exec /usr/lib/eclipse/eclipse \
    -vm "${JAVACMD}" \
    -install "${INSTALL}" \
    -startup "${STARTUP}" \
    ${CMDLINEARGS} \
    -vmargs -Djava.library.path=/usr/lib/jni \
            -Dgnu.gcj.precompiled.db.path=/var/lib/gcj-4.2/classmap.db \
            -Dgnu.gcj.runtime.VMClassLoader.library_control=never \
            -Dosgi.locking=none ${VMARGS}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-4-30 19:36:04 | 显示全部楼层
恩,和windows下一样,把环境变量设置好,这样在文本模式下也能编译运行java了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表