Thread: CLASSPATH Problem ????

CLASSPATH Problem ????

From
Kostas Stergiou
Date:
For the last two days i'm trying to use java on a
linux box but i'm completely lost i'm afraid.
What i want to do is to write an app that will
communicate with a database (oracle or postgres).
I use Suse 9 and postgresql to start.
The database is configured without problems and i can
communicate with it using psql utility (the owner of
the postgres is another user i created also named
postgres).
I can communicate with the db also through C / C++
with no problems.
To use java i download the pg73jdbc3.jar (postgres
version is 7.3.4). I copied that file in /usr/lib/java
and i tried to compile the following program

import java.sql.*;

class JDBCVersion
{
   public static void main (String args[])
          throws SQLException
   {
    Class.forName("org.postgresql.Driver");
   }

The response i got was
unreported exception java.lang.ClassNotFoundException

Trying to resolve that error i've found that there
were no CLASSPATH variable for any user. I added the
line
export
CLASSPATH=/usr/lib/java:/usr/lib/java/pg73jdbc3.jar
in .bash file but that didn't help.
Other vars like JAVA_HOME, JAVA_JDK was already set by
the OS.
Since i'm new in java and linux i tried jbuilderX from
borland in case i could manage it better through IDE.
In jbuilder i added a library through
Tools->Configure Libraries->New->Class->pg73jdbc3.jar
I also added in the class option of
Tools->Configure JDK->User Home
the line
/home/usr/JBuilderX/thirdparty/postgres/pg73jdbc3.jar
and in project properties option i added the jar file
in required libraries
That didn't seem to work also. The same program
doesn't work in the IDE. When i'm trying to use
Database Pilot the postgres driver is always
displaying in red.
I tried the same with oracle 9i and still nothing
works.
Everything seem to work ok in windows 2k installation.
What am i doing wrong in Suse? Is it a CLASSPATH
problem as i believe or it might be something else?

Sorry for the size of the post, but i'm completely
confused

PS i tried another version of the driver
(pg74.1.jdbc3.jar) with the same results

TIA


__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

Re: CLASSPATH Problem ????

From
Bruce Ashton
Date:
What version of Java are you using?

Kostas Stergiou wrote:
> For the last two days i'm trying to use java on a
> linux box but i'm completely lost i'm afraid.
> What i want to do is to write an app that will
> communicate with a database (oracle or postgres).
> I use Suse 9 and postgresql to start.
> The database is configured without problems and i can
> communicate with it using psql utility (the owner of
> the postgres is another user i created also named
> postgres).
> I can communicate with the db also through C / C++
> with no problems.
> To use java i download the pg73jdbc3.jar (postgres
> version is 7.3.4). I copied that file in /usr/lib/java
> and i tried to compile the following program
>
> import java.sql.*;
>
> class JDBCVersion
> {
>    public static void main (String args[])
>           throws SQLException
>    {
>     Class.forName("org.postgresql.Driver");
>    }
>
> The response i got was
> unreported exception java.lang.ClassNotFoundException
>
> Trying to resolve that error i've found that there
> were no CLASSPATH variable for any user. I added the
> line
> export
> CLASSPATH=/usr/lib/java:/usr/lib/java/pg73jdbc3.jar
> in .bash file but that didn't help.
> Other vars like JAVA_HOME, JAVA_JDK was already set by
> the OS.
> Since i'm new in java and linux i tried jbuilderX from
> borland in case i could manage it better through IDE.
> In jbuilder i added a library through
> Tools->Configure Libraries->New->Class->pg73jdbc3.jar
> I also added in the class option of
> Tools->Configure JDK->User Home
> the line
> /home/usr/JBuilderX/thirdparty/postgres/pg73jdbc3.jar
> and in project properties option i added the jar file
> in required libraries
> That didn't seem to work also. The same program
> doesn't work in the IDE. When i'm trying to use
> Database Pilot the postgres driver is always
> displaying in red.
> I tried the same with oracle 9i and still nothing
> works.
> Everything seem to work ok in windows 2k installation.
> What am i doing wrong in Suse? Is it a CLASSPATH
> problem as i believe or it might be something else?
>
> Sorry for the size of the post, but i'm completely
> confused
>
> PS i tried another version of the driver
> (pg74.1.jdbc3.jar) with the same results
>
> TIA
>
>
> __________________________________
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail.
> http://antispam.yahoo.com/tools
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
>

Re: CLASSPATH Problem ????

From
Kostas Stergiou
Date:
Suse 9 comes with jdk1.3 and jbuilder install jdk1.4.1

--- Bruce Ashton <bruce@ashton.net> wrote:
> What version of Java are you using?
>
> Kostas Stergiou wrote:
> > For the last two days i'm trying to use java on a
> > linux box but i'm completely lost i'm afraid.
> > What i want to do is to write an app that will
> > communicate with a database (oracle or postgres).
> > I use Suse 9 and postgresql to start.
> > The database is configured without problems and i
> can
> > communicate with it using psql utility (the owner
> of
> > the postgres is another user i created also named
> > postgres).
> > I can communicate with the db also through C / C++
> > with no problems.
> > To use java i download the pg73jdbc3.jar (postgres
> > version is 7.3.4). I copied that file in
> /usr/lib/java
> > and i tried to compile the following program
> >
> > import java.sql.*;
> >
> > class JDBCVersion
> > {
> >    public static void main (String args[])
> >           throws SQLException
> >    {
> >     Class.forName("org.postgresql.Driver");
> >    }
> >
> > The response i got was
> > unreported exception
> java.lang.ClassNotFoundException
> >
> > Trying to resolve that error i've found that there
> > were no CLASSPATH variable for any user. I added
> the
> > line
> > export
> >
> CLASSPATH=/usr/lib/java:/usr/lib/java/pg73jdbc3.jar
> > in .bash file but that didn't help.
> > Other vars like JAVA_HOME, JAVA_JDK was already
> set by
> > the OS.
> > Since i'm new in java and linux i tried jbuilderX
> from
> > borland in case i could manage it better through
> IDE.
> > In jbuilder i added a library through
> > Tools->Configure
> Libraries->New->Class->pg73jdbc3.jar
> > I also added in the class option of
> > Tools->Configure JDK->User Home
> > the line
> >
>
/home/usr/JBuilderX/thirdparty/postgres/pg73jdbc3.jar
> > and in project properties option i added the jar
> file
> > in required libraries
> > That didn't seem to work also. The same program
> > doesn't work in the IDE. When i'm trying to use
> > Database Pilot the postgres driver is always
> > displaying in red.
> > I tried the same with oracle 9i and still nothing
> > works.
> > Everything seem to work ok in windows 2k
> installation.
> > What am i doing wrong in Suse? Is it a CLASSPATH
> > problem as i believe or it might be something
> else?
> >
> > Sorry for the size of the post, but i'm completely
> > confused
> >
> > PS i tried another version of the driver
> > (pg74.1.jdbc3.jar) with the same results
> >
> > TIA
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Get better spam protection with Yahoo! Mail.
> > http://antispam.yahoo.com/tools
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 7: don't forget to increase your free space
> map settings
> >
> >

__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools

Re: CLASSPATH Problem ????

From
Bruce Ashton
Date:
Perhaps the jar file has become corrupted?  You could try un-jar-ing it
and try running it on the class files

Kostas Stergiou wrote:
> Suse 9 comes with jdk1.3 and jbuilder install jdk1.4.1
>
> --- Bruce Ashton <bruce@ashton.net> wrote:
>
>>What version of Java are you using?
>>
>>Kostas Stergiou wrote:
>>
>>>For the last two days i'm trying to use java on a
>>>linux box but i'm completely lost i'm afraid.
>>>What i want to do is to write an app that will
>>>communicate with a database (oracle or postgres).
>>>I use Suse 9 and postgresql to start.
>>>The database is configured without problems and i
>>
>>can
>>
>>>communicate with it using psql utility (the owner
>>
>>of
>>
>>>the postgres is another user i created also named
>>>postgres).
>>>I can communicate with the db also through C / C++
>>>with no problems.
>>>To use java i download the pg73jdbc3.jar (postgres
>>>version is 7.3.4). I copied that file in
>>
>>/usr/lib/java
>>
>>>and i tried to compile the following program
>>>
>>>import java.sql.*;
>>>
>>>class JDBCVersion
>>>{
>>>   public static void main (String args[])
>>>          throws SQLException
>>>   {
>>>    Class.forName("org.postgresql.Driver");
>>>   }
>>>
>>>The response i got was
>>>unreported exception
>>
>>java.lang.ClassNotFoundException
>>
>>>Trying to resolve that error i've found that there
>>>were no CLASSPATH variable for any user. I added
>>
>>the
>>
>>>line
>>>export
>>>
>>
>>CLASSPATH=/usr/lib/java:/usr/lib/java/pg73jdbc3.jar
>>
>>>in .bash file but that didn't help.
>>>Other vars like JAVA_HOME, JAVA_JDK was already
>>
>>set by
>>
>>>the OS.
>>>Since i'm new in java and linux i tried jbuilderX
>>
>>from
>>
>>>borland in case i could manage it better through
>>
>>IDE.
>>
>>>In jbuilder i added a library through
>>>Tools->Configure
>>
>>Libraries->New->Class->pg73jdbc3.jar
>>
>>>I also added in the class option of
>>>Tools->Configure JDK->User Home
>>>the line
>>>
>>
> /home/usr/JBuilderX/thirdparty/postgres/pg73jdbc3.jar
>
>>>and in project properties option i added the jar
>>
>>file
>>
>>>in required libraries
>>>That didn't seem to work also. The same program
>>>doesn't work in the IDE. When i'm trying to use
>>>Database Pilot the postgres driver is always
>>>displaying in red.
>>>I tried the same with oracle 9i and still nothing
>>>works.
>>>Everything seem to work ok in windows 2k
>>
>>installation.
>>
>>>What am i doing wrong in Suse? Is it a CLASSPATH
>>>problem as i believe or it might be something
>>
>>else?
>>
>>>Sorry for the size of the post, but i'm completely
>>>confused
>>>
>>>PS i tried another version of the driver
>>>(pg74.1.jdbc3.jar) with the same results
>>>
>>>TIA
>>>
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>Get better spam protection with Yahoo! Mail.
>>>http://antispam.yahoo.com/tools
>>>
>>>---------------------------(end of
>>
>>broadcast)---------------------------
>>
>>>TIP 7: don't forget to increase your free space
>>
>>map settings
>>
>>>
>
> __________________________________
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail.
> http://antispam.yahoo.com/tools
>
>