lejos command error of ver.2.1.0 built on MacOS X10.4(Intel)

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

Moderator: roger

lejos command error of ver.2.1.0 built on MacOS X10.4(Intel)

Postby hifukui » Thu Dec 06, 2007 11:48 am

Dear lejos users:

I am a user of lejos_2_1_0 on MacOS X10.2 in Japan.
I tried to install the lejos_2_1_0 on MacOS X10.4(Intel & JDK1.5)
then I was able to build lejos_2_1_0 on it and go well lejosfirmld
but I have lejos command error when I download a sample program to RCX.

The details are as follows:
1) Unarchiving: to ~/Documents/javaworks/lejos2RCX/lejos_2_1_0

2) Setting the following environment variables.
Code: Select all
export JAVA_HOME=/Library/Java/Home
export LEJOS_HOME=~/Documents/javaworks/lejos2RCX/lejos_2_1_0
export PATH=/usr/local/bin:$LEJOS_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$LEJOS_HOME/lib/classes.jar:$LEJOS_HOME/lib/pcrcxcomm.jar
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LEJOS_HOME/bin:$LEJOS_HOME/lib
export RCXTTY=usb


3) Revising three files (Cf. the thread entitled "Errors with Makefiles (Linux and JDK 1.5 do not play nice)" by jon419 and eecharlie):
Change the line as
Code: Select all
JAVAC=javac  =>  JAVAC=javac -target 1.5

in "$LEJOS_HOME/Makefile" and
"$LEJOS_HOME/rcxcomm/rcxclasses/Makefile".
And add the line with semicolon next the line "done_pi:"
(maybe at line 324) in the file
"$LEJOS_HOME/vmsrc/threads.c"
as
Code: Select all
               }
         }
done_pi:
            ;
#endif  // PI_AVOIDANCE

          }


4) Building lejos_2_1_0:
Code: Select all
% cd $LEJOS_HOME
% chmod a+x cctest.sh
% make clean
% make

--- **I have the following message finally.**
Code: Select all
====> Installation of leJOS done!


5) Downloading the firmware:
After connecting the LEGO IR tower to USB on my Mac
and turning on the RCX which is faced the tower,
type the terminal command as
Code: Select all
% lejosfirmdl

--- **I have the following message finally.**
Code: Select all
Use --help for options.
segment.length[0] = 13692 (14k)
segment.length[1] = 2940 (3k)
Total image size=16632 (17k)
Transferring "~/Documents/javaworks/lejos2RCX/lejos_2_1_0/bin/../bin/lejos.srec" to RCX...
100%       


6)Testing a example:
Code: Select all
% cd $LEJOS_HOME/example/hworld
% lejosc -target 1.5 HelloWorld.java

=>Then "HelloWorld.class" file is successfully created.
Note here that "lejosc" without flag "-target 1.5" cause a "target version" error in my Mac.

7) Linking and Downloading the example:
Code: Select all
% lejos HelloWorld

=>Then the following error message is occurred:
Code: Select all
Exception reading java/lang/Object
js.classfile.EClassFileFormat: Version not recognized: 49.0
        at js.classfile.JClassFile.readMagicAndVersions(JClassFile.java:226)
        at js.classfile.JClassFile.read(JClassFile.java:255)
        at js.tinyvm.ClassRecord.getClassRecord(ClassRecord.java:427)
        at js.tinyvm.Binary.processClasses(Binary.java:81)
        at js.tinyvm.Binary.createFromClosureOf(Binary.java:258)
        at js.tinyvm.TinyVM.main(TinyVM.java:109)
        at js.tinyvm.TinyVM.main(TinyVM.java:100)
        at js.tinyvm.TinyVM.main(TinyVM.java:217)
        at js.tinyvm.TinyVM.main(TinyVM.java:251)

Similarly, I tried the link command
Code: Select all
% lejos -o HelloWorld.bin HelloWorld

then I had the same error message.

What should I do?
Please anyone help me.
hifukui
New User
 
Posts: 2
Joined: Thu Dec 06, 2007 7:10 am
Location: Japan

Installation with success!!

Postby hifukui » Fri Dec 07, 2007 1:12 am

Dear lejos users:

I have just found myself the solution for my problem in this thread in another lejos link page from
http://news.lugnet.com/robotics/rcx/java/?n=365.
Then I have been able to install lejos_2_1_0 on MacOS X10.4(Intel & JDK1.5) successfully.

I will summarize for the solution as follows:

Installation for lejos_2_1_0 on MacOS X10.4(Intel & JDK1.5)
1) Unarchiving: to ~/Documents/javaworks/lejos2RCX/lejos_2_1_0
(In my case)

2) Setting the following environment variables.
Code: Select all
export JAVA_HOME=/Library/Java/Home
export LEJOS_HOME=~/Documents/javaworks/lejos2RCX/lejos_2_1_0
export PATH=/usr/local/bin:$LEJOS_HOME/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$LEJOS_HOME/lib/classes.jar:$LEJOS_HOME/lib/pcrcxcomm.jar
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LEJOS_HOME/bin:$LEJOS_HOME/lib
export RCXTTY=usb


3) Revising three files (Cf. the thread entitled "Errors with Makefiles (Linux and JDK 1.5 do not play nice)" by jon419 and eecharlie):
(I had mistake in my previous post.)
Change the line as
Code: Select all
JAVAC=javac -target 1.1  =>  JAVAC=javac -target 1.1 -source 1.2

in "$LEJOS_HOME/Makefile" and "$LEJOS_HOME/rcxcomm/rcxclasses/Makefile".
And add the line with semicolon next the line "done_pi:" (maybe at line 324) in the file "$LEJOS_HOME/vmsrc/threads.c"
as
Code: Select all
               }
         }
done_pi:
            ;
#endif  // PI_AVOIDANCE

          }


4) Building lejos_2_1_0:
Code: Select all
% cd $LEJOS_HOME
% chmod a+x cctest.sh
% make clean
% make

--- **I have the following message successfully.**
Code: Select all
====> Installation of leJOS done!


5) Downloading the firmware:
After connecting the LEGO IR tower to USB on my Mac and turning on the RCX which is faced the tower,
type the terminal command as
Code: Select all
% lejosfirmdl -f

--- **I have the following message successfully.**
Code: Select all
Use --help for options.
segment.length[0] = 13692 (14k)
segment.length[1] = 2940 (3k)
Total image size=16632 (17k)
Transferring "~/Documents/javaworks/lejos2RCX/lejos_2_1_0/bin/../bin/lejos.srec" to RCX...
100%       


6)Testing a example:
Compiling
Code: Select all
% cd $LEJOS_HOME/example/hworld
% lejosc -target 1.1 -source 1.2 HelloWorld.java

=>Then "HelloWorld.class" file is successfully created.
(These flags "-target 1.1 -source 1.2" is tiresome, but it is necessary.)

Linking and Downloading to RCX
Code: Select all
% lejos HelloWorld

=>Then the RCX sounds beep successfully.
You can run the sample program by the green button on RCX.
Alternative:
Code: Select all
% lejos -o HelloWorld.bin HelloWorld
%lejosrun HelloWorld.bin


Good Luck!
hifukui
New User
 
Posts: 2
Joined: Thu Dec 06, 2007 7:10 am
Location: Japan

Postby bbagnall » Wed Dec 12, 2007 4:30 pm

Thanks for posting that solution, Hifukui. It's important to do that in case others run into the same problem.
User avatar
bbagnall
Site Admin
 
Posts: 383
Joined: Fri Aug 04, 2006 4:03 pm

EClassFileFormat: Version not recognized

Postby tsinn » Fri Jan 22, 2010 3:34 am

I'm running osx 10.5.8
java: 1.5
lejos: 2_1_0
tower: usb
RCX v. 1.0 and 2.0

The error:
js.classfile.EClassFileFormat: Version not recognized: 49.0
at js.classfile.JClassFile.readMagicAndVersions(JClassFile.java:229)
at js.classfile.JClassFile.read(JClassFile.java:258)
at js.tinyvm.ClassRecord.getClassRecord(ClassRecord.java:427)
at js.tinyvm.Binary.processClasses(Binary.java:81)
at js.tinyvm.Binary.createFromClosureOf(Binary.java:258)
at js.tinyvm.TinyVM.main(TinyVM.java:109)
at js.tinyvm.TinyVM.main(TinyVM.java:100)
at js.tinyvm.TinyVM.main(TinyVM.java:217)
at js.tinyvm.TinyVM.main(TinyVM.java:252)

is due to the kMajorVersion and kMinorVersion value in js.classfile.JClassFile.java

They are set to 3 and 45. I did a System.out.println on the
values being passed into the readMagicAndVersions method. They don't match the expected values. The values that lejos is passing in (from the HelloWorld file) was 0 for the min and 49 for the max.

I changed the values in js.classes.JClassFile.java
(which is in the jtools dir in lejos)
Mine now looks like (I left the old ones there in case it needs to go back):
// public static final int kMinorVersion = 3;
public static final int kMinorVersion = 0;
//public static final int kMajorVersion = 45;
public static final int kMajorVersion = 49;


I also changed the Makefile to say
JAVAC=javac -target 1.5

There are two other makefiles you need to change too. They are in:
rcxcomm/rcxclasses/Makefile
rcxcomm/classes/Makefile

I also added a target value where it calls javac in:
/bin/lejosjc

(on mac or unix, you can go to the root of the project (eg: lejos_2_1_0) and type
grep -R "javac" .
That will dump all the places javac is called.

I then did a clean via:
sudo make clean

and a build via:
sudo make.

I could then download the firmware using
lejosfirmdl
I then linked and downloaded via:
lejoslink

I hope this helps someone.
tsinn
New User
 
Posts: 4
Joined: Fri Jan 22, 2010 2:55 am


Return to RCX Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff