1

Derby says to install to opt, so I did:

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:~$ 

Now, do what value do I set for /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/"

do I call the env variable DERBY_INSTALL? What value should it have?

I'm just trying to use ij tool.

Here's what I have so far:

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# 

ok, well maybe it works:

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# 

While it does work from the same console:

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# 

I get errors in another console:

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# 

Why doesn't the other console work?

1 Answer 1

1

The only reasonable explanation is that you didn't initialize the classpath in the second console !
I suppose it is done here :

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


Manually :

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
3
  • yes, this is my thinking as well, articulated by you, thank you. Since posting the question, I've discovered that derby is available on aptitude as sun-javadb-client and so forth, so I'm going to try that route. However, just for my edification, how would you run setEmbeddedCP so that effects the CLASSPATH env variable "globally"? I'm sure that I asked that question in a backwards way.
    – Thufir
    Aug 24, 2012 at 8:24
  • 1
    imho You have to insert a call to setEmbeddedCP into .bashrc. Aug 24, 2012 at 8:30
  • I'm almost certain that this answer is the solution, only I've, for the time being, removed the manual install of derby and am looking into another approach.
    – Thufir
    Aug 24, 2012 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.