Eclipse and Mac OS X Snow Leopard

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

Moderators: 99jonathan, roger, imaqine

Eclipse and Mac OS X Snow Leopard

Postby gathomas » Wed Sep 02, 2009 10:41 pm

I upgraded my MacBook to snow Leopard and I am now unable to upload my programs using ANT and Eclipse. I am able to compile my programs using Eclipse and can then upload using the nxjbrowse tool so I know that communication with my brick (both USB and Bluetooth) is not an issue. I get the following error when using either the 'upload' or 'uploadandrun' options in the build file.

upload:
[java] leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver
[java] Native Library bluecove not available
[java] leJOS NXJ> Exception in open: Open of Mr. Roboto failed: BlueCove library bluecove not available
[java] leJOS NXJ> Failed to connect to any NXT
[java] An error occurred: No NXT found - is it switched on and plugged in (for USB)?
BUILD SUCCESSFUL


I had this setup working under Leopard quite nicely so I'm looking for ideas as to what I might be missing. Any help would be appreciated.

Cheers,

Geoff
gathomas
New User
 
Posts: 4
Joined: Sun Aug 16, 2009 2:28 am
Location: Calgary, AB, CA

Re: Eclipse and Mac OS X Snow Leopard

Postby Shawn » Thu Sep 03, 2009 11:24 am

gathomas wrote: I am able to compile my programs using Eclipse and can then upload using the nxjbrowse tool so I know that communication with my brick (both USB and Bluetooth) is not an issue.


Well at least it still works and you won't have to go cold turkey. Hey, now I know it's safe to upgrade. You said both USB and bluetooth were working via command line right. If so, I would first suspect path issues.

upload:
[java] leJOS NXJ> Failed to load USB comms driver: Cannot load USB driver


Hmmn, the name was changed in the 8.5 release from libjfantom.dylib to libjfantom.jnilib. 10.5 users should be able to use either (10.3 or so may not be able to use dylib we are so trying to have wider support). How are you specifying where the driver is in your Ant file? Try changing the name back and see. What version of NXJ are you using?


[java] Native Library bluecove not available
[java] leJOS NXJ> Exception in open: Open of Mr. Roboto failed: BlueCove library bluecove not available
[java] leJOS NXJ> Failed to connect to any NXT
[java] An error occurred: No NXT found - is it switched on and plugged in (for USB)?
BUILD SUCCESSFUL


For bluecove I have no idea. My guesses are (and these are just guesses) maybe:

1) there is something wrong in your new ant build that doesn't point to the jar

2) for some reason they are loaded differently and perhaps ant is using 64 bit java which doesn't seem to be compatible with bluetooth. On thing you could do is set ALL java applications to use 32 but in /Applications/Utilities/Java/Java Preferences.app
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Postby gathomas » Thu Sep 03, 2009 1:02 pm

Yep both work great via command line, it's a start but it's a little annoying because I'm trying to code a class for the mindsensors NXTLineLeader right now so I have to switch programs a lot as I get little things to work.

the name was changed in the 8.5 release from libjfantom.dylib to libjfantom.jnilib


What do you you mean 8.5 release? To get it to work in 10.6 you have to use .dylib. I've also had to set the java preferences to 32-but system wide for this to work because I'm not aware how to do this on a per program basis. I have set the build path in my sample.properties file as follows:

nxj.home=/Applications/leJOS_NXJ
nxj.classes.home=${nxj.home}
nxj.jtools.home=${nxj.home}
nxj.pctools.home=${nxj.home}
nxj.pccomm.home=${nxj.home}
nxj.library.path=${nxj.home}/bin
nxj.classes.jar=${nxj.classes.home}/lib/classes.jar
nxj.jtools.jar=${nxj.jtools.home}/lib/jtools.jar
nxj.pctools.jar=${nxj.pctools.home}/lib/pctools.jar
nxj.pccomm.jar=${nxj.pccomm.home}/lib/pccomm.jar
nxj.commons.jar=${nxj.jtools.home}/3rdparty/lib/commons-cli.jar
nxj.bcel.jar=${nxj.jtools.home}/3rdparty/lib/bcel.jar
nxj.bluecove.jar=${nxj.pccomm.home}/3rdparty/lib/bluecove.jar
nxj.bluecove-gpl.jar=${nxj.pccomm.home}/3rdparty/lib/bluecove-gpl.jar


The result of running 'env' in terminal is:

TERM_PROGRAM=Apple_Terminal
TERM=xterm-color
SHELL=/bin/bash
TMPDIR=/var/folders/nc/ncDxyq24FrifFGbj3bz2rE+++TI/-Tmp-/
Apple_PubSub_Socket_Render=/tmp/launch-dOYZsg/Render
TERM_PROGRAM_VERSION=272
USER=Geoff
COMMAND_MODE=unix2003
SSH_AUTH_SOCK=/tmp/launch-b7QFJp/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Applications/leJOS_NXJ/bin
PWD=/Users/Geoff
LANG=en_CA.UTF-8
NXJ_HOME=/Applications/leJOS_NXJ
SHLVL=1
HOME=/Users/Geoff
DYLD_LIBRARY_PATH=/Applications/leJOS_NXJ/bin
LOGNAME=Geoff
DISPLAY=/tmp/launch-wYQK2C/:0
_=/usr/bin/env


From what you say it seems like ANT is probably the culprit but not being a Java developer normally I'm not sure where to start looking, any ideas?
gathomas
New User
 
Posts: 4
Joined: Sun Aug 16, 2009 2:28 am
Location: Calgary, AB, CA

Postby Shawn » Thu Sep 03, 2009 3:09 pm

the name was changed in the 8.5 release from libjfantom.dylib to libjfantom.jnilib

What do you you mean 8.5 release? To get it to work in 10.6 you have to use .dylib.


Eh? NXJ .85 OSX10.5 lets me use .jnilib.

I've also had to set the java preferences to 32-but system wide for this to work because I'm not aware how to do this on a per program basis.


Um, me neither and I don't know if such an option exists.

I have set the build path in my sample.properties file as follows:

nxj.home=/Applications/leJOS_NXJ
nxj.library.path=${nxj.home}/bin


Well, this path is the same as your working command line path
Code: Select all
/Applications/leJOS_NXJ/bin/


..so..

Do you have this line in ant ()
Code: Select all
<jvmarg value="-Djava.library.path=${nxj.library.path}"/>


it should be in the upload or uploadandrun target of build.xml -- then it should work.

If it doesnt try throwing in a <jvmarg value="java -d32"/> everyplace you can. This will tell Java to use 32bits as our fantom driver doesn't and can't (without Lego rewriting it) support 64bits.

For example:

Code: Select all
 <target name="uploadandrun" depends="link"
        description="upload and run the binary " >
      <java classname="lejos.pc.tools.NXJUpload" fork="true">
         <arg value="-u"/>
                        <jvmarg value="java -d32"/>
         <jvmarg value="-Djava.library.path=${nxj.library.path}"/>

etc etc ...

The result of running 'env' in terminal is:
DYLD_LIBRARY_PATH=/Applications/leJOS_NXJ/bin


This is letting your system find our jlibfantom.jnilib and is the equivilant of <jvmarg value="-Djava.library.path=${nxj.library.path}"/>

From what you say it seems like ANT is probably the culprit but not being a Java developer normally I'm not sure where to start looking, any ideas?


Hey me neither.
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Re: Eclipse and Mac OS X Snow Leopard

Postby TheTedinator » Sat Dec 31, 2011 2:18 am

I am having the same problem. Using the nxjflashg GUI tool through eclipse or the command line tool, it tells me that an error has occurred and it cannot load the libjfantom.jnilib file. Help?
TheTedinator
New User
 
Posts: 5
Joined: Sat Dec 31, 2011 2:13 am

Re: Eclipse and Mac OS X Snow Leopard

Postby skoehler » Sat Dec 31, 2011 2:21 am

Use leJOS 0.9.0 and copy/paste the output you see in the console window.
skoehler
leJOS Team Member
 
Posts: 1431
Joined: Thu Oct 30, 2008 4:54 pm

Re: Eclipse and Mac OS X Snow Leopard

Postby TheTedinator » Sat Dec 31, 2011 3:34 am

skoehler wrote:Use leJOS 0.9.0 and copy/paste the output you see in the console window.

After using the command "nxjflash" in terminal, I get:
Building firmware image.
VM file: /Users/teddy/Documents/lejos_nxj/bin/lejos_nxt_rom.bin
Menu file: /Users/teddy/Documents/lejos_nxj/bin/StartUpText.bin
Magic string found at offset 0x40
VM size: 55712 bytes.
Menu size: 44132 bytes.
Total image size 99940/100352 bytes.
Locating device in firmware update mode.
lejos.pc.comm.NXTCommException: cannot load library /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib
at lejos.pc.comm.NXTCommFactory.createNXTComm(NXTCommFactory.java:64)
at lejos.pc.comm.NXTSamba.search(NXTSamba.java:134)
at lejos.pc.tools.NXJFlashUpdate.openSambaDevice(NXJFlashUpdate.java:209)
at lejos.pc.tools.NXJFlash.openDevice(NXJFlash.java:65)
at lejos.pc.tools.NXJFlash.run(NXJFlash.java:142)
at lejos.pc.tools.NXJFlash.start(NXJFlash.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at lejos.pc.tools.ToolStarter.startTool(ToolStarter.java:31)
at lejos.pc.tools.NXJFlash.main(NXJFlash.java:186)
Caused by: lejos.util.jni.JNIException: cannot load library /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib
at lejos.util.jni.JNILoader.loadLibrary(JNILoader.java:112)
at lejos.pc.comm.NXTCommFantom.initialize0(NXTCommFantom.java:89)
at lejos.pc.comm.NXTCommFantom.initialize(NXTCommFantom.java:96)
at lejos.pc.comm.NXTCommFactory.newNXTCommInstance(NXTCommFactory.java:92)
at lejos.pc.comm.NXTCommFactory.createNXTComm(NXTCommFactory.java:62)
... 11 more
Caused by: java.lang.UnsatisfiedLinkError: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib: Library not loaded: /Library/Frameworks/Fantom.framework/Versions/1/Fantom Referenced from: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib Reason: no suitable image found. Did find: /usr/local/lib/Fantom: stat() failed with errno=13
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1020)
at lejos.util.jni.JNILoader.loadLibrary(JNILoader.java:103)
... 15 more

I'm using bluetooth on Snow Leopard.
TheTedinator
New User
 
Posts: 5
Joined: Sat Dec 31, 2011 2:13 am

Re: Eclipse and Mac OS X Snow Leopard

Postby skoehler » Sat Dec 31, 2011 3:41 am

That's the relevant part:
TheTedinator wrote:
Caused by: java.lang.UnsatisfiedLinkError: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib: Library not loaded: /Library/Frameworks/Fantom.framework/Versions/1/Fantom Referenced from: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib Reason: no suitable image found. Did find: /usr/local/lib/Fantom: stat() failed with errno=13
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1823)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1699)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1020)
at lejos.util.jni.JNILoader.loadLibrary(JNILoader.java:103)
... 15 more

I'm using bluetooth on Snow Leopard.


This error is not about bluetooth. nxjflash only operates via USB.

I'm not sure what is wrong. Maybe Shawn can help. However, some googling suggests that errno=13 basically means "Permission denied". So please check, whether you can access /Library/Frameworks/Fantom.framework/Versions/1/Fantom. I'm also not sure why /usr/local/lib/Fantom is mentioned. Does it even exist on your system?

You may also want to try the following command on the command line to further debug the issue:
Code: Select all
otool -L /path/to/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib

and then post the output here.

Have you installed the latest Fantom driver (1.1.3 is the latest version)? If not, download it here:
http://mindstorms.lego.com/en-us/suppor ... river.aspx

I have just tried using leJOS 0.9.0 on Mac OS X Lion 64 Bit by installing Fantom Driver 1.1.3 and running nxjflash. Works without a hassle.
skoehler
leJOS Team Member
 
Posts: 1431
Joined: Thu Oct 30, 2008 4:54 pm

Re: Eclipse and Mac OS X Snow Leopard

Postby Shawn » Sat Dec 31, 2011 7:08 am

TheTedinator wrote:Caused by: java.lang.UnsatisfiedLinkError: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib: Library not loaded: /Library/Frameworks/Fantom.framework/Versions/1/Fantom Referenced from: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib Reason: no suitable image found. Did find: /usr/local/lib/Fantom: stat() failed with errno=13


From that I think skoehler has it right -- it looks like you need to install the Fantom driver from the link he posted.

Shawn
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Re: Eclipse and Mac OS X Snow Leopard

Postby skoehler » Sun Jan 01, 2012 2:13 am

It could also be the start script. Open nxjflash in your favourite editor, and prepend "echo" to the last line of the shell script. After your change, the last line should look something like this
Code: Select all
echo "$JAVA" $NXJ_FORCE32 ....


I suspect, the -d32 flag might not be added properly. If it is missing, I get exactly the same error as TheTedinator.
skoehler
leJOS Team Member
 
Posts: 1431
Joined: Thu Oct 30, 2008 4:54 pm

Re: Eclipse and Mac OS X Snow Leopard

Postby TheTedinator » Mon Jan 02, 2012 1:35 am

Shawn wrote:
TheTedinator wrote:Caused by: java.lang.UnsatisfiedLinkError: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib: Library not loaded: /Library/Frameworks/Fantom.framework/Versions/1/Fantom Referenced from: /Users/teddy/Documents/lejos_nxj/lib/pc/native/macosx/libjfantom.jnilib Reason: no suitable image found. Did find: /usr/local/lib/Fantom: stat() failed with errno=13


From that I think skoehler has it right -- it looks like you need to install the Fantom driver from the link he posted.

Shawn


Yes, thanks to both of you. Once I installed it, I could flash it just fine. Thank you!
TheTedinator
New User
 
Posts: 5
Joined: Sat Dec 31, 2011 2:13 am


Return to NXJ Software

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests

more stuff