Linking a .class to the RCX brick

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

Moderator: roger

Linking a .class to the RCX brick

Postby Whereis404 » Fri Jan 28, 2011 1:23 am

I am trying to link a .class file that I made to the RCX brick. I am at the last part of http://lejos.sourceforge.net/tutorial/getstarted/firstbrick/win32.html and I am typing
Code: Select all
lejos.bat distributionsmoketest
into the cmd window. It gives me this

Code: Select all

Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)

where options include:
    -client     to select the "client" VM
    -server     to select the "server" VM
    -hotspot     is a synonym for the "client" VM  [deprecated]
                  The default VM is client.
                 
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose[:class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                    see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image


Is there anyway to fix this?

Thanks
~404
Whereis404
New User
 
Posts: 2
Joined: Fri Jan 28, 2011 1:18 am
Location: CANADA

Postby Walt White » Sat Jan 29, 2011 5:50 pm

Hi ~404,

It's been awhile since I configured RCX, but I do have notes that show a common problem of having spaces in paths will generate results like what you show above.

In my case, though, I saw the problem in the step that creats the .class file, and you seem to have gotten past that step. I will do my best to describe what I noted and hope that you can find how it applies to your situation:

In a nutshell, modern (in the past five years since these RCX .bat files were written) computers have a space somewhere in their CLASSPATH. Mine has, for instance:
Code: Select all
c:\Program Files\leJOS NXJ\bin;

That space between "Program" and "Files" can cause the leJOS RCX .bat files to fail. So I modified the lejosjc.bat file:
Code: Select all
@echo off
if "%LEJOS_HOME%" == ""  goto homeless
javac -bootclasspath %LEJOS_HOME%\lib\classes.jar;%LEJOS_HOME%\lib\rcxcomm.jar;%CLASSPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:homeless
echo LEJOS_HOME not defined
:end

and removed
Code: Select all
;%CLASSPATH%

and renamed it lejosjcNoClassPath:
Code: Select all
@echo off
if "%LEJOS_HOME%" == ""  goto homeless
javac -bootclasspath %LEJOS_HOME%\lib\classes.jar;%LEJOS_HOME%\lib\rcxcomm.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:homeless
echo LEJOS_HOME not defined
:end

So I'm guessing that you also have a space somewhere in some element like LEJOS_HOME in lejos.bat:
Code: Select all
@echo off
rem lejos: Java tool to link and download java programs for LeJOS
rem 08/08/06  created Matthias Paul Scholz
if "%LEJOS_HOME%" == ""  goto homeless
set THIRDPARTY_LIBS="%LEJOS_HOME%\3rdparty\lib"
set LINK_CLASSPATH=.;%LEJOS_HOME%\lib\classes.jar;%LEJOS_HOME%\lib\jtools.jar;%THIRDPARTY_LIBS%\commons-cli-1.0.jar;%THIRDPARTY_LIBS%\bcel-5.1.jar;%LEJOS_HOME%\lib\rcxcomm.jar;%LEJOS_HOME%\lib\pcrcxcomm.jar
java -Djava.library.path="%LEJOS_HOME%\bin" -classpath "%LINK_CLASSPATH%" js.tools.LejosLinkAndDownload --writeorder BE --classpath "%LINK_CLASSPATH%" -tty %RCXTTY% %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:homeless
echo LEJOS_HOME not defined
:end


For instance, if you installed leJOS under "c:\Program Files\leJOS" it might cause the error you are seeing. My installation works and I installed it at the root of c:\
Code: Select all
LEJOS_HOME=c:\leJOS_3.0


Hope this helps.

Walt
Walt White
Novice
 
Posts: 43
Joined: Sun Aug 06, 2006 11:57 pm
Location: California Central Valley

Postby Whereis404 » Mon Jan 31, 2011 11:03 pm

Hey, my I still have the same problem

I have set
Code: Select all
CLASSPATH =.;"C:\Program Files\Java\jre6\lib\ext\QTJava.zip";C:\ProgramFiles\Lejos\lib;.;%LEJOS_HOME%/lib/classes.jar;%LEJOS_HOME%/lib/pcrcxcomm.jar

Lejos_Home = "C:\ProgramFiles\Lejos"

(User) Path = $LEJOS_HOME$\Bin;"C:\Program Files\Java\jdk1.6.0_20\bin"

(System) Path = $LEJOS_HOME/bin;"C:\ProgramFiles\Lejos\bin";"C:\Program Files\Java\jdk1.6.0_20\bin"
Whereis404
New User
 
Posts: 2
Joined: Fri Jan 28, 2011 1:18 am
Location: CANADA


Return to RCX Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff