NoClassDefFoundError:org/apache/derby/tools/ij

NoClassDefFoundError:org/apache/derby/tools/ij

德比表示安装选择, 所以我做了:

thufir@dur:~$ 
thufir@dur:~$ ll /opt/db-derby-10.9.1.0-bin/lib/derbytools.jar 
-rw-r--r-- 1 root root 174932 May 31 12:19 /opt/db-derby-10.9.1.0-bin/lib/derbytools.jar
thufir@dur:~$ 
thufir@dur:~$ ll /opt/db-derby-10.9.1.0-bin/bin/ij
-rwxr-xr-x 1 root root 5876 May 31 12:18 /opt/db-derby-10.9.1.0-bin/bin/ij*
thufir@dur:~$ 

现在,我应该为 /etc/environment 设置什么值?

thufir@dur:~$ 
thufir@dur:~$ cat /etc/environment 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME="/usr/lib/jvm/java-6-openjdk-i386/jre/"

我该如何调用环境变量 DERBY_INSTALL?它应该有什么值?

我只是想使用 ij 工具。

以下是我目前所掌握的信息:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# source /etc/environment 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# echo $DERBY_INSTALL
/opt/db-derby-10.9.1.0-bin/lib/
root@dur:/opt/db-derby-10.9.1.0-bin/bin# echo $DERBY_HOME
/opt/db-derby-10.9.1.0-bin/
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# . setEmbeddedCP
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# java org.apache.derby.tools.sysinfo
------------------ Java Information ------------------
Java Version:    1.6.0_24
Java Vendor:     Sun Microsystems Inc.
Java home:       /usr/lib/jvm/java-6-openjdk-i386/jre
Java classpath:  /opt/db-derby-10.9.1.0-bin//lib/derby.jar:/opt/db-derby-10.9.1.0-bin//lib/derbytools.jar:
OS name:         Linux
OS architecture: i386
OS version:      3.2.0-23-generic
Java user name:  root
Java user home:  /root
Java user dir:   /opt/db-derby-10.9.1.0-bin/bin
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
java.runtime.version: 1.6.0_24-b24
--------- Derby Information --------
[/opt/db-derby-10.9.1.0-bin/lib/derby.jar] 10.9.1.0 - (1344872)
[/opt/db-derby-10.9.1.0-bin/lib/derbytools.jar] 10.9.1.0 - (1344872)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale :  [English/United States [en_US]]
Found support for locale: [cs]
     version: 10.9.1.0 - (1344872)
Found support for locale: [de_DE]
     version: 10.9.1.0 - (1344872)
Found support for locale: [es]
     version: 10.9.1.0 - (1344872)
Found support for locale: [fr]
     version: 10.9.1.0 - (1344872)
Found support for locale: [hu]
     version: 10.9.1.0 - (1344872)
Found support for locale: [it]
     version: 10.9.1.0 - (1344872)
Found support for locale: [ja_JP]
     version: 10.9.1.0 - (1344872)
Found support for locale: [ko_KR]
     version: 10.9.1.0 - (1344872)
Found support for locale: [pl]
     version: 10.9.1.0 - (1344872)
Found support for locale: [pt_BR]
     version: 10.9.1.0 - (1344872)
Found support for locale: [ru]
     version: 10.9.1.0 - (1344872)
Found support for locale: [zh_CN]
     version: 10.9.1.0 - (1344872)
Found support for locale: [zh_TW]
     version: 10.9.1.0 - (1344872)
------------------------------------------------------
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 

好的,也许它可以起作用:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# echo $CLASSPATH
/opt/db-derby-10.9.1.0-bin//lib/derby.jar:/opt/db-derby-10.9.1.0-bin//lib/derbytools.jar:
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# java org.apache.derby.tools.ij
ij version 10.9
ij> quit
> ;
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 

虽然它确实可以在同一个控制台上运行:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# cd /root/apache-james-3.0-beta4/var/store/derby/
root@dur:~/apache-james-3.0-beta4/var/store/derby# 
root@dur:~/apache-james-3.0-beta4/var/store/derby# java org.apache.derby.tools.ijij version 10.9
ij> quit
> ;
root@dur:~/apache-james-3.0-beta4/var/store/derby# 

我在另一个控制台中收到错误:

root@dur:~/apache-james-3.0-beta4/var/store/derby# 
root@dur:~/apache-james-3.0-beta4/var/store/derby# java org.apache.derby.tools.ij
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/derby/tools/ij
Caused by: java.lang.ClassNotFoundException: org.apache.derby.tools.ij
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.apache.derby.tools.ij. Program will exit.
root@dur:~/apache-james-3.0-beta4/var/store/derby# 

为什么另一个控制台不工作?

答案1

唯一合理的解释是你没有在第二个控制台中初始化类路径!
我想它在这里完成:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# . setEmbeddedCP


手动:

CLASSPATH=/opt/db-derby-10.9.1.0-bin/lib/derby.jar:/opt/db-derby-10.9.1.0-bin/lib/derbytools.jar
java org.apache.derby.tools.ij

相关内容