You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by dan <da...@elvberg.com> on 2006/04/04 21:32:29 UTC

PATH (newbie) problems...

>>From the getstartderby.pdf:
"You need to set your PATH environment variable so the JVM and Java
applications run
correctly. This is extremely important for the success of your
installation because the
PATH variable enables your operating system to find the appropriate
programs from any
directory. If you have more than one JVM installed, the JVM you want to
use must appear
before any of the others in the PATH variable.
To check the PATH environment variable:
  1. In a command window, type the following:
      java -version
      If the path is set correctly, you will see a printout telling you
the version of your JVM.
  2. If the command does not return the correct version of your JVM, set
the PATH
      variable by adding the bin subdirectory of the JVM directory to
the beginning of the
      path.
      For example, if the directory is C:\JDK1.4, add C:\JDK1.4\bin to
the beginning
      of the path.
  3. Repeat step 1 to make sure the PATH environment variable is set
correctly."

command
java -version
results in (I'm on Linux, Fedora Core 4):
"
$ java -version
java version "1.4.2"
gij (GNU libgcj) version 4.0.0 20050519 (Red Hat 4.0.0-8)

Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
"
In my /usr/java I have the folders
j2sdk1.4.2_09
jdk1.5.0_04
jre1.5.0_04

but I have no JAVA_HOME when I
echo $JAVA_HOME

>2. If the command does not return the correct version of your JVM, set
the PATH
      >variable by adding the bin subdirectory of the JVM directory to
the beginning of the
      >path.
How do manage #2? /dan



Re: PATH (newbie) problems...

Posted by Oystein Grovlen - Sun Norway <Oy...@Sun.COM>.
John Embretsen wrote:

> Then, in order to start the network server, all you have to do is to 
> execute
> the startNetworkServer.ksh script:
> 
> $ ${DERBY_INSTALL}/frameworks/NetworkServer/bin/startNetworkServer.ksh
> 
> (this works as long as the execute bit is set for the script file)

Note that someone in this thread pointed out that this may not be 
sufficient if you have already defined a CLASSPATH.  This can be solved 
by doing 'source setNetworkServerCP.ksh' before one tries to start the 
network server.

-- 
Øystein

Re: PATH (newbie) problems...

Posted by John Embretsen <Jo...@Sun.COM>.
Hi dan,

dan wrote:

> Yesterday everything was fine but today I cannot start the server using 
> the modified
> scripts (all 8 attached) and either as user dan or root. Please see below.
> /dan

I think you are making this more complicated than it really is. You should
not have to edit all the scripts or run as root in order to e.g. start the
network server (that is what you are trying to achieve, correct?). So let's
start from the beginning and see if things work:

I assume you have downloaded Derby 10.1.2.1 "bin" (zip or tar.gz).
After extracting that archive, you will find a directory called "frameworks".
You find scripts for starting the server and so on in

frameworks/NetworkServer/bin

In order to make the .ksh scripts (I only tried the "startNetworkServer.ksh"
script this time) work in a linux environment, there are only *two* things
you need to do first, since the scripts depend on these settings (unless, of
course you change all the scripts yourself, which obviously complicates
things even more):

1. Set the environment variable DERBY_INSTALL to the directory where you have
installed derby, i.e. the parent directory of the frameworks directory.

Example (1) (bash shell):

$ export DERBY_INSTALL="/home/user/derby/db-derby-10.1.2.1-bin"

To check the value of DERBY_INSTALL, do:

$ echo $DERBY_INSTALL


2. Set the environment variable JAVA_HOME to the Java installation you want
to use for running Derby (using the scripts).

Example (2) (bash shell):

$ export JAVA_HOME="/usr/java/jdk1.5.0_04"

To check the value of JAVA_HOME, do:

$ echo $JAVA_HOME


Then, in order to start the network server, all you have to do is to execute
the startNetworkServer.ksh script:

$ ${DERBY_INSTALL}/frameworks/NetworkServer/bin/startNetworkServer.ksh

(this works as long as the execute bit is set for the script file)

You can of course cd to that directory before executing the script, or
including the script directory in your PATH for easy access, but I won't get
into that here.

Here is what happens on my machine when I follow the steps above:

Server is ready to accept connections on port 1527.


Please try it if you're still stuck...

So far you have (for instance) been mixing client and server classpath
scripts, so I recommend using unmodified scripts and starting over as
explained above.

Hope it helps!


-- 
John






Re: PATH (newbie) problems...

Posted by dan <da...@elvberg.com>.
Hi Anthos:
>1. Are you using the .ksh from
db-derby-10.1.2.1-bin/frameworks/NetworkServer/bin/ ?
yes
>2. somehow derbynet.jar is missing in your classpath which is why this
error.
I've added derbynet.jar to the classpath in the script. The downloaded
one had that
file missing as you can see from attachment
"downloaded_setNetworkClientCP.ksh".

Yesterday everything was fine but today I cannot start the server using
the modified
scripts (all 8 attached) and either as user dan or root. Please see
below.
/dan
"
[dan@localhost ~]$ cd $DERBY_INSTALL/frameworks/NetworkServer/bin
[dan@localhost bin]$ ./setNetworkClientCP.ksh
CLASSPATH=/home/dan/DerbyInstall/lib/derby.jar:/home/dan/DerbyInstall/lib/derbytools.jar:/home/dan/DerbyInstall/lib/derbynet.jar:
/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar:
/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin-g.jar
[dan@localhost bin]$ ./startNetworkServer.ksh
2006-04-06 09:03:28.164 GMT Thread[main,5,main]
java.io.FileNotFoundException: derby.log (Permission denied)
Could not listen on port 1527 on host localhost.
Could not listen on port 1527 on host localhost.
[dan@localhost bin]$ su
Password:
[root@localhost bin]# $ cd $DERBY_INSTALL/frameworks/NetworkServer/bin
bash: $: command not found
[root@localhost bin]#
cd /home/dan/DerbyInstall/frameworks/NetworkServer/bin
[root@localhost bin]#  ./setNetworkClientCP.ksh
CLASSPATH=/home/dan/DerbyInstall/lib/derby.jar:/home/dan/DerbyInstall/lib/derbytools.jar:/home/dan/DerbyInstall/lib/derbynet.jar:/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar:/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin-g.jar
[root@localhost bin]#  ./startNetworkServer.ksh
Could not listen on port 1527 on host localhost.
[root@localhost bin]# echo $PATH
/usr/kerberos/sbin:/usr/java/jdk1.5.0_04/bin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/dan/bin
[root@localhost bin]# echo $DERBY_INSTALL
/home/dan/DerbyInstall
[root@localhost bin]#
"







Re: PATH (newbie) problems...

Posted by Anil Samuel <an...@gmail.com>.
1. Are you using the .ksh from
db-derby-10.1.2.1-bin/frameworks/NetworkServer/bin/
?
2. somehow derbynet.jar is missing in your classpath which is why this
error.

Anthos

On 4/6/06, dan <da...@elvberg.com> wrote:
>
> Hi Anil:
> This is what I get
> "
> [dan@localhost bin]$ ./setNetworkClientCP.ksh
>
> CLASSPATH=/home/dan/DerbyInstall/lib/derbyclient.jar:/home/dan/DerbyInstall/lib/derbytools.jar:
>
> /home/dan/mysql-
> connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar:
> /home/dan/mysql-
> connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin-g.jar:
> /home/dan/cos-05Nov2002.zip_FILES/lib/cos.jar
> [dan@localhost bin]$
> "
> /dan
>
>
> ---------- Forwarded message ----------
> From: "Anil Samuel" <an...@gmail.com>
> To: "Derby Discussion" <de...@db.apache.org>
> Date: Thu, 6 Apr 2006 07:47:14 +1000
> Subject: Re: PATH (newbie) problems...
> Can you add
> echo CLASSPATH=$CLASSPATH
> at the end of the setNetworkClientCP.ksh, try executing the script and
> post here the console output.
>
> Anthos
>
> On 4/5/06, dan <da...@elvberg.com> wrote:
> >
> > Hi Anil:
> > I've changed the scripts according to your recommendation, from
> > [ -z "$CLASSPATH" ] && {
> >   . "$DERBY_INSTALL"/frameworks/NetworkServer/bin/setNetworkClientCP.ksh
> > }
> > to
> > $DERBY_INSTALL/frameworks/NetworkServer/bin/setNetworkClientCP.ksh
> > Correct?
> > However I get this [image: :-(]:
> >
> > [dan@localhost bin]$ ./setNetworkServerCP.ksh
> > [dan@localhost bin]$ ./startNetworkServer.ksh
> > Exception in thread "main" java.lang.NoClassDefFoundError:
> > org/apache/derby/drda /NetworkServerControl
> > [dan@localhost bin]$
> >
> >
> >
> >
> >
> > ---------- Forwarded message ----------
> > From: "Anil Samuel" <an...@gmail.com>
> > To: "Derby Discussion" < derby-user@db.apache.org>
> > Date: Wed, 5 Apr 2006 20:56:52 +1000
> > Subject: Re: PATH (newbie) problems...
> > Hi
> >
> > I think
> >
> > [ -z "$CLASSPATH" ] && {
> >   . "$DERBY_INSTALL"/frameworks/NetworkServer/bin/setNetworkServerCP.ksh
> >
> > }
> >
> > in all .ksh files, causes the set*CP.ksh call to be skipped if CLASSPATH
> > is defined. This can cause this issue.
> >
> > I edited my .ksh files to remove
> >
> > [ -z "$CLASSPATH" ] &&
> >
> > and it works just fine.
> >
> > Anthos
> > n 4/5/06, dan <da...@elvberg.com> wrote:
> > >
> > >  Hi Øystein:
> > > Last line in startNetworkServer.ksh (attached) is
> > > $JAVA_HOME/bin/java org.apache.derby.drda.NetworkServerControl start
> > > -h $DERBY_SERVER_HOST -p $DERBY_SERVER_PORT
> > >
> > > where /java is a file...
> > > ...and where is
> > > org.apache.derby.drda.NetworkServerControl? /dan
> > >
> > >
> > > ---------- Forwarded message ----------
> > > From: Oystein Grovlen - Sun Norway <Oystein.Grovlen@Sun.COM >
> > > To: Derby Discussion < derby-user@db.apache.org>
> > > Date: Wed, 05 Apr 2006 10:30:55 +0200
> > > Subject: Re: PATH (newbie) problems...
> > > dan wrote:
> > >
> > > > 3. Executing startNetworkServer results in
> > > > [dan@localhost bin]$   ./startNetworkServer.ksh
> > > > ./startNetworkServer.ksh: line 56: /usr/java/bin/java: No such file
> > > or
> > > > directory[dan@localhost bin]$
> > >
> > > Have you set JAVA_HOME? If not, the script will default to /usr/java,
> > > but according to your path it should be /usr/java/jdk1.5.0_04.
> > >
> > > --
> > > Øystein Grøvlen, Senior Staff Engineer
> > > Sun Microsystems, Database Technology Group
> > > Trondheim, Norway
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Anil Samuel < anil.samuel@oracle.com>
> > Principal Technical Member
> > Product Development
> > Oracle Corporation
> >
>
>
>
> --
> Anil Samuel <an...@oracle.com>
> Principal Technical Member
> Product Development
> Oracle Corporation
>



--
Anil Samuel <an...@oracle.com>
Principal Technical Member
Product Development
Oracle Corporation

Re: PATH (newbie) problems...

Posted by dan <da...@elvberg.com>.
Hi Anil:
This is what I get
"
[dan@localhost bin]$ ./setNetworkClientCP.ksh
CLASSPATH=/home/dan/DerbyInstall/lib/derbyclient.jar:/home/dan/DerbyInstall/lib/derbytools.jar:
/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar:
/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin-g.jar:
/home/dan/cos-05Nov2002.zip_FILES/lib/cos.jar
[dan@localhost bin]$
"
/dan

Re: PATH (newbie) problems...

Posted by Anil Samuel <an...@gmail.com>.
Can you add
echo CLASSPATH=$CLASSPATH
at the end of the setNetworkClientCP.ksh, try executing the script and post
here the console output.

Anthos

On 4/5/06, dan <da...@elvberg.com> wrote:
>
> Hi Anil:
> I've changed the scripts according to your recommendation, from
> [ -z "$CLASSPATH" ] && {
>   . "$DERBY_INSTALL"/frameworks/NetworkServer/bin/setNetworkClientCP.ksh
> }
> to
> $DERBY_INSTALL/frameworks/NetworkServer/bin/setNetworkClientCP.ksh
> Correct?
> However I get this [image: :-(]:
>
> [dan@localhost bin]$ ./setNetworkServerCP.ksh
> [dan@localhost bin]$ ./startNetworkServer.ksh
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/derby/drda /NetworkServerControl
> [dan@localhost bin]$
>
>
>
>
>
> ---------- Forwarded message ----------
> From: "Anil Samuel" <an...@gmail.com>
> To: "Derby Discussion" <de...@db.apache.org>
> Date: Wed, 5 Apr 2006 20:56:52 +1000
> Subject: Re: PATH (newbie) problems...
> Hi
>
> I think
>
> [ -z "$CLASSPATH" ] && {
>   . "$DERBY_INSTALL"/frameworks/NetworkServer/bin/setNetworkServerCP.ksh
> }
>
> in all .ksh files, causes the set*CP.ksh call to be skipped if CLASSPATH
> is defined. This can cause this issue.
>
> I edited my .ksh files to remove
>
> [ -z "$CLASSPATH" ] &&
>
> and it works just fine.
>
> Anthos
> n 4/5/06, dan <da...@elvberg.com> wrote:
> >
> >  Hi Øystein:
> > Last line in startNetworkServer.ksh (attached) is
> > $JAVA_HOME/bin/java org.apache.derby.drda.NetworkServerControl start -h
> > $DERBY_SERVER_HOST -p $DERBY_SERVER_PORT
> >
> > where /java is a file...
> > ...and where is
> > org.apache.derby.drda.NetworkServerControl? /dan
> >
> >
> > ---------- Forwarded message ----------
> > From: Oystein Grovlen - Sun Norway <Oy...@Sun.COM>
> > To: Derby Discussion < derby-user@db.apache.org>
> > Date: Wed, 05 Apr 2006 10:30:55 +0200
> > Subject: Re: PATH (newbie) problems...
> > dan wrote:
> >
> > > 3. Executing startNetworkServer results in
> > > [dan@localhost bin]$   ./startNetworkServer.ksh
> > > ./startNetworkServer.ksh: line 56: /usr/java/bin/java: No such file or
> > > directory[dan@localhost bin]$
> >
> > Have you set JAVA_HOME? If not, the script will default to /usr/java,
> > but according to your path it should be /usr/java/jdk1.5.0_04.
> >
> > --
> > Øystein Grøvlen, Senior Staff Engineer
> > Sun Microsystems, Database Technology Group
> > Trondheim, Norway
> >
> >
> >
> >
> >
>
>
> --
> Anil Samuel < anil.samuel@oracle.com>
> Principal Technical Member
> Product Development
> Oracle Corporation
>



--
Anil Samuel <an...@oracle.com>
Principal Technical Member
Product Development
Oracle Corporation

Re: PATH (newbie) problems...

Posted by dan <da...@elvberg.com>.
Hi Anil:
I've changed the scripts according to your recommendation, from
[ -z "$CLASSPATH" ] && {
  . "$DERBY_INSTALL"/frameworks/NetworkServer/bin/setNetworkClientCP.ksh
}
 to
$DERBY_INSTALL/frameworks/NetworkServer/bin/setNetworkClientCP.ksh
Correct?
However I get this :-(:
[dan@localhost bin]$ ./setNetworkServerCP.ksh
[dan@localhost bin]$ ./startNetworkServer.ksh
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/derby/drda /NetworkServerControl
[dan@localhost bin]$




Re: PATH (newbie) problems...

Posted by dan <da...@elvberg.com>.
Hi Anil:
Sorry the change shall be
{
  . "$DERBY_INSTALL"/frameworks/NetworkServer/bin/setNetworkServerCP.ksh
}
and not
$DERBY_INSTALL/frameworks/NetworkServer/bin/setNetworkClientCP.ksh

Everything is running perfect now. :-) You, Anil! /dan
-- 
HaD:-)! Dan nästan jämt
0730 48 36 39

"Utan tvivel är man inte klok" (Tage Danielsson).

Re: PATH (newbie) problems...

Posted by John Embretsen <Jo...@Sun.COM>.
Anders Morken wrote:

> No, a change in the environment of a process does not affect the
> environment of it's parent process. So, if you run
> startNetworkServer.ksh as a regular script (which will execute in a
> separate process), it will not affect the CLASSPATH of your shell
> environment. 
> 
> However, on Windows with cmd and .BAT files you'll see the effect you
> describe. =)

You are right, thank you for correcting me!
Also, if you source these scripts, which I have a tendency to do
(e.g. $ . ./startNetworkServer.ksh) you will also see this effect.


-- 
John




Re: PATH (newbie) problems...

Posted by Anders Morken <an...@stud.ntnu.no>.
John Embretsen:
> I'm sure it does, but if you then run these scripts several times without 
> un-setting the CLASSPATH in between, you will end up with a rather long and 
> messy CLASSPATH, which may cause unexpected errors down the road. Each 
> invocation of the setNetworkServerCP.ksh _adds_ derby.jar, derbytools.jar 
> and derbynet.jar to the CLASSPATH.

No, a change in the environment of a process does not affect the
environment of it's parent process. So, if you run
startNetworkServer.ksh as a regular script (which will execute in a
separate process), it will not affect the CLASSPATH of your shell
environment. 

However, on Windows with cmd and .BAT files you'll see the effect you
describe. =)

-- 
Anders Morken

My opinions may have changed, but not the fact that I am right!

Re: PATH (newbie) problems...

Posted by John Embretsen <Jo...@Sun.COM>.
Anil Samuel wrote:

> I edited my .ksh files to remove
> 
> [ -z "$CLASSPATH" ] &&
> 
> and it works just fine.

I'm sure it does, but if you then run these scripts several times without 
un-setting the CLASSPATH in between, you will end up with a rather long and 
messy CLASSPATH, which may cause unexpected errors down the road. Each 
invocation of the setNetworkServerCP.ksh _adds_ derby.jar, derbytools.jar and 
derbynet.jar to the CLASSPATH.

So you should

a) Check what your CLASSPATH is

	echo $CLASSPATH

b) If the classpath mentions any of the derby jars serveral times, unset the 
CLASSPATH

	export CLASSPATH=

c) If you are using the startNetworkServer.ksh script to start the network 
server, you need to set JAVA_HOME first, since the script uses this to 
determine where your java installation is (and defaults to /usr/java, as 
Øystein mentioned).

	export JAVA_HOME=/usr/java/jdk1.5.0_04
(or whatever the path to the java installation you want to use is)

Alternatively, you can modify the script not to use JAVA_HOME, but a path of 
your choice.

d) run the unmodified version of startNetworkServer.ksh (i.e., the one 
including [ -z "$CLASSPATH" ] &&) when you want to start the network server.



-- 
John

Re: PATH (newbie) problems...

Posted by Anil Samuel <an...@gmail.com>.
Hi

I think

[ -z "$CLASSPATH" ] && {
  . "$DERBY_INSTALL"/frameworks/NetworkServer/bin/setNetworkServerCP.ksh
}

in all .ksh files, causes the set*CP.ksh call to be skipped if CLASSPATH is
defined. This can cause this issue.

I edited my .ksh files to remove

[ -z "$CLASSPATH" ] &&

and it works just fine.

Anthos
n 4/5/06, dan <da...@elvberg.com> wrote:
>
> Hi Øystein:
> Last line in startNetworkServer.ksh (attached) is
> $JAVA_HOME/bin/java org.apache.derby.drda.NetworkServerControl start -h
> $DERBY_SERVER_HOST -p $DERBY_SERVER_PORT
>
> where /java is a file...
> ...and where is
> org.apache.derby.drda.NetworkServerControl? /dan
>
>
> ---------- Forwarded message ----------
> From: Oystein Grovlen - Sun Norway <Oy...@Sun.COM>
> To: Derby Discussion <de...@db.apache.org>
> Date: Wed, 05 Apr 2006 10:30:55 +0200
> Subject: Re: PATH (newbie) problems...
> dan wrote:
>
> > 3. Executing startNetworkServer results in
> > [dan@localhost bin]$   ./startNetworkServer.ksh
> > ./startNetworkServer.ksh: line 56: /usr/java/bin/java: No such file or
> > directory[dan@localhost bin]$
>
> Have you set JAVA_HOME? If not, the script will default to /usr/java,
> but according to your path it should be /usr/java/jdk1.5.0_04.
>
> --
> Øystein Grøvlen, Senior Staff Engineer
> Sun Microsystems, Database Technology Group
> Trondheim, Norway
>
>
>
>
>


--
Anil Samuel <an...@oracle.com>
Principal Technical Member
Product Development
Oracle Corporation

Re: PATH (newbie) problems...

Posted by Oystein Grovlen - Sun Norway <Oy...@Sun.COM>.
dan wrote:
> Hi Øystein:
> Last line in startNetworkServer.ksh (attached) is
> $JAVA_HOME/bin/java org.apache.derby.drda.NetworkServerControl start -h 
> $DERBY_SERVER_HOST -p $DERBY_SERVER_PORT
> 
> where /java is a file...
> ...and where is
> org.apache.derby.drda.NetworkServerControl? /dan
> ------------------------------------------------------------------------

I do not understand exactly what you are asking for, but:

$JAVA_HOME needs to point to where you have installed java.  I pointed 
out that it seems from your path and the error you got, that this has 
not been done.

org.apache.derby.drda.NetworkServerControl is in derbynet.jar.  This 
needs to be in your classpath. setNetworkServerCP.ksh will set up this 
for you if you set DERBY_INSTALL to the directory where you have 
installed Derby.

-- 
Øystein Grøvlen, Senior Staff Engineer
Sun Microsystems, Database Technology Group
Trondheim, Norway

Re: PATH (newbie) problems...

Posted by dan <da...@elvberg.com>.
Hi Øystein:
Last line in startNetworkServer.ksh (attached) is
$JAVA_HOME/bin/java org.apache.derby.drda.NetworkServerControl start -h
$DERBY_SERVER_HOST -p $DERBY_SERVER_PORT

where /java is a file...
...and where is
org.apache.derby.drda.NetworkServerControl? /dan

Re: PATH (newbie) problems...

Posted by Oystein Grovlen - Sun Norway <Oy...@Sun.COM>.
dan wrote:

> 3. Executing startNetworkServer results in
> [dan@localhost bin]$   ./startNetworkServer.ksh
> ./startNetworkServer.ksh: line 56: /usr/java/bin/java: No such file or 
> directory[dan@localhost bin]$

Have you set JAVA_HOME? If not, the script will default to /usr/java, 
but according to your path it should be /usr/java/jdk1.5.0_04.

-- 
Øystein Grøvlen, Senior Staff Engineer
Sun Microsystems, Database Technology Group
Trondheim, Norway

Re: PATH (newbie) problems...

Posted by Nicolas Dufour <ni...@neometsys.fr>.
dan a écrit :

> 3. Executing startNetworkServer results in
> [dan@localhost bin]$   ./startNetworkServer.ksh
> ./startNetworkServer.ksh: line 56: /usr/java/bin/java: No such file or
> directory[dan@localhost bin]$
>
Dan, you haven't understand that the JAVA_HOME variable is vital to
derby (as for any java application).

That's why the script startNetworkServer.ksh picks /usr/java by default
and produce this error.

You must therefore set this variable correctly to the right path of the
java you use (1.4 or 1.5).

Regards

Nicolas

Re: PATH (newbie) problems...

Posted by dan <da...@elvberg.com>.
Hi Susan:
:-) You for valuable contribution to my learning curve!
According to Brian Leonard's Blog here are the steps
for starting the Derby Server:

        
     1. Download the latest official Derby release (10.1.2.1 at the time
        of this writing) and extract the archive. 
     2. Set the DERBY_INSTALL environment variable to point to your
        Derby installation location. For me this is D:
        \db-derby-10.1.2.1-bin.

1.+2. = done.

Start the Derby Server

     1. Open a command prompt and switch to the
        $DERBY_INSTALL/frameworks/NetworkServer/bin directory.
     2. Execute the setNetworkServerCP script, which sets the necessary
        Derby jars on the classpath. 
     3. Execute the startNetworkServer script to start Derby. You should
        then see something like the following:
        
        


1. Here are the files in bin:
[dan@localhost ~]$ cd /$DERBY_INSTALL/frameworks/NetworkServer/bin
[dan@localhost bin]$ ls -l
total 136
-rwxr-xr-x  1 dan dan 1113 Nov  2 13:44 dblook.bat
-rwxr-xr-x  1 dan dan  922 Nov  2 13:44 dblook.ksh
-rwxr-xr-x  1 dan dan 1510 Nov  2 13:44 ij.bat
-rwxr-xr-x  1 dan dan 1161 Nov  2 13:44 ij.ksh
-rwxr-xr-x  1 dan dan 1213 Nov  2 13:44 NetworkServerControl.bat
-rwxr-xr-x  1 dan dan  986 Nov  2 13:44 NetworkServerControl.ksh
-rwxr-xr-x  1 dan dan  716 Nov  2 13:44 setNetworkClientCP.bat
-rwxr-xr-x  1 dan dan  615 Nov  2 13:44 setNetworkClientCP.ksh
-rwxr-xr-x  1 dan dan  742 Nov  2 13:44 setNetworkServerCP.bat
-rwxr-xr-x  1 dan dan  642 Nov  2 13:44 setNetworkServerCP.ksh
-rwxr-xr-x  1 dan dan 1543 Nov  2 13:44 startNetworkServer.bat
-rwxr-xr-x  1 dan dan 1699 Apr  5 09:37 startNetworkServer.ksh
-rwxr-xr-x  1 dan dan 1702 Apr  5 09:35 startNetworkServer.ksh~
-rwxr-xr-x  1 dan dan 1806 Nov  2 13:44 stopNetworkServer.bat
-rwxr-xr-x  1 dan dan 1697 Nov  2 13:44 stopNetworkServer.ksh
-rwxr-xr-x  1 dan dan 1307 Nov  2 13:44 sysinfo.bat
-rwxr-xr-x  1 dan dan 1255 Nov  2 13:44 sysinfo.ksh

2. Executing setNetworkServerCP results in
[dan@localhost bin]$ ./setNetworkServerCP.ksh
[dan@localhost bin]$
i.e. 'nothing' (visible)

3. Executing startNetworkServer results in
[dan@localhost bin]$   ./startNetworkServer.ksh
./startNetworkServer.ksh: line 56: /usr/java/bin/java: No such file or
directory[dan@localhost bin]$

I attach the setNetworkServerCP.ksh and startNetworkServer.ksh files
My present PATHs and CLASSPATHs are resp:
PATH
[dan@localhost bin]$ echo $PATH
/usr/java/jdk1.5.0_04:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/dan/bin
[dan@localhost bin]$
(I've added /usr/java/jdk1.5.0_04 to the PATH acc to your
recommendation)
CLASSPATH
[dan@localhost bin]$ echo $CLASSPATH
/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar:
/home/dan/mysql-connector-java-3.1.10.tar.gz_FILES/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin-g.jar:
/home/dan/cos-05Nov2002.zip_FILES/lib/cos.jar
[dan@localhost bin]$

Help! /dan


Re: PATH (newbie) problems...

Posted by Susan Cline <ho...@pacbell.net>.
Hi Dan,

See my comments interleaved in your message below.

Susan

--- dan <da...@elvberg.com> wrote:

> >From the getstartderby.pdf:
> "You need to set your PATH environment variable so the JVM and Java
> applications run
> correctly. This is extremely important for the success of your
> installation because the
> PATH variable enables your operating system to find the appropriate
> programs from any
> directory. If you have more than one JVM installed, the JVM you want to
> use must appear
> before any of the others in the PATH variable.
> To check the PATH environment variable:
>   1. In a command window, type the following:
>       java -version
>       If the path is set correctly, you will see a printout telling you
> the version of your JVM.
>   2. If the command does not return the correct version of your JVM, set
> the PATH
>       variable by adding the bin subdirectory of the JVM directory to
> the beginning of the
>       path.
>       For example, if the directory is C:\JDK1.4, add C:\JDK1.4\bin to
> the beginning
>       of the path.
>   3. Repeat step 1 to make sure the PATH environment variable is set
> correctly."
> 
> command
> java -version
> results in (I'm on Linux, Fedora Core 4):
> "
> $ java -version
> java version "1.4.2"
> gij (GNU libgcj) version 4.0.0 20050519 (Red Hat 4.0.0-8)

So currently your PATH variable is most likely pointing to 
the /usr/java/j2sdk1.4.2_09 installation.

Since java -version shows the version 1.4.2, it means that
java is found in your path already.

> In my /usr/java I have the folders
> j2sdk1.4.2_09
> jdk1.5.0_04
> jre1.5.0_04
> 
> but I have no JAVA_HOME when I
> echo $JAVA_HOME

Unless you have a need to set JAVA_HOME for some other application or
program (I could not find a reference to JAVA_HOME in the Getting Started
Guide) you do not need to set it for Derby.

If you want to set JAVA_HOME and you are running with a Borne or Korn
shell on Linux (as long as it is not csh) the following command will
set your JAVA_HOME environment variable:

$export JAVA_HOME=/usr/java/j2sdk1.4.2_09

> 
> >2. If the command does not return the correct version of your JVM, set
> the PATH
>       >variable by adding the bin subdirectory of the JVM directory to
> the beginning of the
>       >path.
> How do manage #2? /dan

Your PATH variable is set to a bin directory of a JVM, however it may  not
be the one you want based on your comments.

To see your current PATH type this:

$ echo $PATH

the output should be something like this (this is an example from my linux box):

sh-2.05b$ echo $PATH
/opt/kde3/bin:/opt/gnome/bin:/usr/games:/usr/bin/X11:/usr/local/bin:/usr/bin:/bin:/usr/lib/java/jre/bin

Also, if you use the 'which' command you should be able to see which java executable
your PATH includes.

sh-2.05b$ which java
/usr/lib/java/jre/bin/java

Now, if you want to change your PATH to pick up a different version of Java,
for instance, if you wanted to use your /usr/java/jdk1.5.0_04 version,
this command would work to set the PATH:

$ export PATH=/usr/java/jdk1.5.0_04/bin:$PATH