Problem in RCX-PC-connection PC-program

This is where you talk about the RCX software itself, installation issues, and programming talk.

Moderator: roger

Problem in RCX-PC-connection PC-program

Postby McFly » Wed Jan 23, 2008 3:54 pm

Hy,
I'm trying to write a program for my rcx that connects to the pc every hour,
but i'm having some problems with the program that runs on the pc.
I try to compile the Read.java in the oustream-example of the rcxcomm.
Thats no problem, the .class-file is made, but if i run
"java Read i get the following error:

C:\lejos\rcxcomm\examples\outstream>java Read
Exception in thread "main" java.lang.NoClassDefFoundError: Read
Caused by: java.lang.ClassNotFoundException: Read
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)


Where's the problem?
My CLASSPATH looks like this:
CLASSPATH=C:\lejos\lib\classes.jar;C:\lejos\lib\pcrcxcomm.jar;C:\Programme\Java\
jre1.6.0_04\lib\ext\QTJava.zip


Where's the failing?

Thanks a lot

Felix


P.S:

The code of the program:
Code: Select all
import josx.rcxcomm.*;
import java.io.*;

/**  Runs on the PC and communicates with Write.java RCX example.
 * Compile with javac with pcrcxcomm.jar on the CLASSPATH
 */
public class Read {
  public static void main(String [] args) throws IOException {
    RCXPort port = new RCXPort();
    InputStream in = port.getInputStream();
    int b = in.read();
    System.out.println("Read: " + b);
  }
}

McFly
New User
 
Posts: 1
Joined: Mon Jan 21, 2008 2:19 pm

Postby jvance » Thu Jan 24, 2008 2:31 am

It appears to me that your .class file is not their. Or maybe your jre is not installed correctly.
Also, why did this code compile when there is no String argument in the RCXPort constructor? As far as I know, the RCXPort constructor needs a String argument--usb, COM to tell it where to write.
Oh, lastly make sure you have a .; in your CLASSPATH for instance instead of
CLASSPATH=C:\lejos\lib\classes.jar;C:\lejos\lib\pcrcxcomm.jar;C:\Programme\Java\
jre1.6.0_04\lib\ext\QTJava.zip

you would have
CLASSPATH=.;C:\lejos\lib\classes.jar;C:\lejos\lib\pcrcxcomm.jar;C:\Programme\Java\
jre1.6.0_04\lib\ext\QTJava.zip

Try that out. The .; tells java to search in the current directory as well as the rest of the CLASSPATH
V
jvance
New User
 
Posts: 22
Joined: Sun Aug 12, 2007 2:22 am


Return to RCX Software

Who is online

Users browsing this forum: heema and 0 guests

more stuff