¡¾ÇóÖú¡¿ÎÒµÄj2sdk°²×°ºÍÅäÖÃÒÔºó»¹ÊDz»ÐУ¡£¡Çë°ï°ïÎÒ
ÎÒµÄϵͳÊÇred hat es 3£¬kernel 2.4.21-9.EL-i686,×°ÁËj2sdk-1_4_0-fcs-linux-i386.rpm£¬¸ù¾ÝһЩÌû×ÓÎÒ°É/etc/profielÅäÖÃÈçÏ£º
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi}
# Path manipulation
JAVA_HOME=/usr/java/j2sdk
CLASSPATH=/usr/java/j2sdk/lib/tools.jar:/usr/java/j2sdk/lib/dt.jar
PATH=$PATH:$HOME/bin:/usr/java/j2sdk/bin £¨ÒÔÉÏ3ÐÐÊǸù¾ÝÏà¹ØÅäÖÃÌû×ÓдµÄ£©
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
export JAVA_HOME CLASSPATH
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
ÅäÖÃÍê±Ïºó
# source /etc/profile
ÔËÐÐÁíÒ»¸öСµÄjavaÓïÑÔ
ÆÁÄ»ÏÔʾÈçÏ£º
Error:failed /usr/java/j2sdk/jre/lib/i386/client/libjvm.so,because libstdc++-libc6.1-
1.so.2:connot open shared object file:No such file or directory
ÊÇÕâ¸öj2sdk°æ±¾²»ÊʺÏÎÒµÄϵͳ»¹ÊÇÎÒµÄÅäÖÃÄÄÀïÓÐÎÊÌâÄØ?ÊDz»ÊÇϵͳÉÙʲôÎļþÄØ£¿
лл´ó¼ÒÄܸøÎÒÖ¸µãÒ»ÏÂ^_^ check these files:
/lib/libc.so.6 (glibc)
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.4.0(your gcc version)/libstdc++.so.5 (gcc's c++)
if they are missing, install them :) ÎÒ´ÓÍøÉÏÕÒÁËÒ»¸ölibstdc++6-3.4.2-67517cl.i386.rpm£¬Õâ¸ö¿ÉÒÔÂð£¿
°²×°ÒÔºó£¬ÔÚÄãÉϱßÖ¸³öµÄ·¾¶Ï»¹ÊÇûÓÐÄǸöÎļþ£¬ÎÒ¸ÃÔõô×ö£¿ make sure there rpms are installed, some of them are for development, but they are useful when you install software from source ball :)
Following file names are from Fedora Core 2. Under Redhat, may be the same.
glibc-2.3.3-27.i686.rpm
glibc-common-2.3.3-27.i386.rpm
glibc-devel-2.3.3-27.i386.rpm
glibc-headers-2.3.3-27.i386.rpm
glibc-utils-2.3.3-27.i386.rpm
cpp-3.3.3-7.i386.rpm
gcc-3.3.3-7.i386.rpm
gcc-c++-3.3.3-7.i386.rpm
libgcc-3.3.3-7.i386.rpm
libstdc++-3.3.3-7.i386.rpm
libstdc++-devel-3.3.3-7.i386.rpm
From your error message, you must install this one "libstdc++-3.3.3-7.i386.rpm" or name like "libstdc++-(version).(arch).rpm".
Try these two:
[url]http://download.fedora.redhat.com/pub/fedora/linux/core/1/i386/os/Fedora/RPMS/libstdc++-3.3.2-1.i386.rpm[/url]
[url]http://download.fedora.redhat.com/pub/fedora/linux/core/1/i386/os/Fedora/RPMS/libstdc++-devel-3.3.2-1.i386.rpm[/url]
The path I listed in my message is under Gentoo Linux. If you can install software from source, only need two package, glibc and gcc :) thank you very much!!
ÎÞÂÛÊÇ·ñ³É¹²¶¼ºÜ¸Ðл¥ÉϵÄÐÖµÜ^_^ [root@localhost home]# java hello.class
Exception in thread "main" java.lang.NoClassDefFoundError: hello/class
ÎҵĴíÎóÐÅÏ¢:(
Çë¸ßÊÖÖ¸½Ì. ÎÒÒѾÉèºÃÁË·¾¶Ö®ÀàµÄ
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/java/j2sdk1.4.2_05/bin:/usr/java/j2sdk1.4.2_05/jre/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:.:/opt/rtems-4.6/bin
CLASSPATH=/usr/java/j2sdk1.4.2_05/lib:/usr/java/j2sdk1.4.2_05/jre/lib:.
JAVA_HOME=/usr/java/j2sdk1.4.2_05 "java -cp . hello", no ".class", "-cp ." is to set CLASSPATH with current directory if hello.class is under it. :(
Please read some Java book or JDK document, this is too basic. [root@localhost home]# java hello.class
Exception in thread "main" java.lang.NoClassDefFoundError: hello/class
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡&&&&&&&&&&&&&&&&&&&&&&&&&&£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤£¤
hello.class£¿£¿£¿£¿£¿£¿£¿£¿
²»ÊÇHello.classÂ𣿣¿£¿
javaµÄÀàÃûµÚÒ»¸ö×ÖĸҪ´óдµÄ£» ÆäÓà ͬ¥ÉÏ ÎÒ¿´¼ûµÄPATHÊÇÕâÑùÉèÖõģº
×¢Ò⣺ ´óдºÍÐ¡Ð´ÒªÇø·Ö,j2sdk1.4.2.03µÄ°²×°Â·¾¶ÊÇÔÚÓû§µÄÖ÷Îļþ¼ÐϵĺÍ1.4.2_02ÒÔǰµÄ·¾¶ÊDz»Ò»ÑùµÄ
export PATH=/usr/java/j2sdk1.4.2_02/bin:$PATH
export NPX_PLGIN_PATH=/usr/java/j2sdk1.4.2_0/jre/plugin/i38
×îºóÊäÈ룺java -versionÃüÁî½øÐмìÑéÈç¹û³É¹¦»á¿´¼ûJDKµÄ°æ±¾ºÅ:w
Ò³:
[1]