You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by siddharth srivastava <ak...@gmail.com> on 2011/08/03 03:00:41 UTC

Unable to run a java file

Hi

I am trying to execute a java file(attached), it compiles fine but when I
try to run it I get a ClassNotFoundException.

It used to run smoothly till a week ago, but probably I have something
missing in my environment which I am not able to figure out.
Can anybody help

Thanks

-- 
Regards
Siddharth Srivastava

Re: Unable to run a java file

Posted by Bryan Pendleton <bp...@gmail.com>.
On 08/03/2011 11:54 AM, siddharth srivastava wrote:
> Java classpath:  C:\Users\siddharth\workspace\derbytrunk\jars\sane\derby.jar;C:\
> Users\siddharth\workspace\derbytrunk\jars\sane\derbytools.jar;C:\Users\siddharth
> \workspace\derbytrunk\jars\sane\derbyTesting.jar;C:\Users\siddharth\workspace\de
> rbytrunk\jars\sane\derbyrun.jar;C:\Users\siddharth\workspace\derbytrunk\jars\san
> e\derbynet.jar;C:\Users\siddharth\workspace\derbytrunk\jars\sane\derbyclient.jar
> ;C:\Users\siddharth\workspace\derbytrunk\tools\java\junit.jar;C:\Users\siddharth
> \workspace\derbytrunk\tools\java\jakarta-oro-2.0.8

It doesn't look like you have "." in that classpath. If the class DerbyPreparedStatement.class
is the one that you got the ClassNotFoundException on, then I don't think it's in
any of those jars.

Try doing:

    set CLASSPATH=.;%CLASSPATH%

and then run

    java DerbyPreparedStatement

(this assumes that DerbyPreparedStatement.class is in your current directory).

thanks,

bryan

Re: Unable to run a java file

Posted by siddharth srivastava <ak...@gmail.com>.
Hi

>From the same window where you get the ClassNotFoundException,
> try running org.apache.derby.tools.**sysinfo, and paste the output
> into an email reply so we can see it.
>
>
>

Here is the output:

------------------ Java Information ------------------
Java Version:    1.6.0_25
Java Vendor:     Sun Microsystems Inc.
Java home:       C:\Program Files\Java\jre6
Java classpath:
 C:\Users\siddharth\workspace\derbytrunk\jars\sane\derby.jar;C:\
Users\siddharth\workspace\derbytrunk\jars\sane\derbytools.jar;C:\Users\siddharth
\workspace\derbytrunk\jars\sane\derbyTesting.jar;C:\Users\siddharth\workspace\de
rbytrunk\jars\sane\derbyrun.jar;C:\Users\siddharth\workspace\derbytrunk\jars\san
e\derbynet.jar;C:\Users\siddharth\workspace\derbytrunk\jars\sane\derbyclient.jar
;C:\Users\siddharth\workspace\derbytrunk\tools\java\junit.jar;C:\Users\siddharth
\workspace\derbytrunk\tools\java\jakarta-oro-2.0.8
OS name:         Windows 7
OS architecture: amd64
OS version:      6.1
Java user name:  siddharth
Java user home:  C:\Users\siddharth
Java user dir:   C:\Users\siddharth\workspace
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
java.runtime.version: 1.6.0_25-b06
--------- Derby Information --------
JRE - JDBC: Java SE 6 - JDBC 4.0
[C:\Users\siddharth\workspace\derbytrunk\jars\sane\derby.jar] 10.9.0.0 alpha
- (
1152597M)
[C:\Users\siddharth\workspace\derbytrunk\jars\sane\derbytools.jar] 10.9.0.0
alph
a - (1152597M)
[C:\Users\siddharth\workspace\derbytrunk\jars\sane\derbynet.jar] 10.9.0.0
alpha
- (1152597M)
[C:\Users\siddharth\workspace\derbytrunk\jars\sane\derbyclient.jar] 10.9.0.0
alp
ha - (1152597M)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale :  [English/United States [en_US]]
Found support for locale: [cs]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [de_DE]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [es]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [fr]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [hu]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [it]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [ja_JP]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [ko_KR]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [pl]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [pt_BR]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [ru]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [zh_CN]
         version: 10.9.0.0 alpha - (1152597M)
Found support for locale: [zh_TW]
         version: 10.9.0.0 alpha - (1152597M)
------------------------------------------------------


>  bryan
>



-- 
Regards
Siddharth Srivastava

Re: Unable to run a java file

Posted by Bryan Pendleton <bp...@gmail.com>.
> I am trying to execute a java file(attached), it compiles fine but when I try to run it I get a ClassNotFoundException.

That's pretty much always a CLASSPATH issue.

 From the same window where you get the ClassNotFoundException,
try running org.apache.derby.tools.sysinfo, and paste the output
into an email reply so we can see it.

If sysinfo also gives you a ClassNotFoundException, then:

	$ echo $CLASSPATH

and do 'ls' on each item in the classpath to confirm that each exists.

thanks,

bryan