Environment Setup Help

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

Moderators: roger, 99jonathan, imaqine

Environment Setup Help

Postby napti » Mon Jul 23, 2012 3:05 pm

Hi, I am currently trying to get started using LeJOS with Linux and have been following this tutorial: http://lejos.sourceforge.net/nxt/nxj/tu ... dLinux.htm

I am having problems setting up the environment variables and am not sure exactly what to do for this section of the tutorial. I don't really understand how to add things to the PATH environment variable and do what it is explaining.

I installed LeJOS NXJ and the JDK in to the following:
LeJOS NXJ into /opt/ LeJOS_NXJ_0..9.1beta-3
JDK into /usr/lib/jvm/java-1.6.0-openjdk

If anyone could help by explaining what I need to do and what to type in the terminal that would be great!

Thank you!
napti
New User
 
Posts: 3
Joined: Mon Jul 23, 2012 2:34 pm

Re: Environment Setup Help

Postby foliot » Wed Jul 25, 2012 2:26 am

These things are added to your ~/.bashrc file. If you properly installed java, the JAVA_HOME variable should already be set and you don't have to change that.

Lejos needs to know where to find certain files. The path to these files is stored in NXJ_HOME. To add NXJ_HOME to your environment, add a line like this to your ~/.bashrc file, putting the actual path of your lejos folder where I have written <path_to_lejos>.:
export NXJ_HOME="<path_to_lejos>"

The quotes need to be there, but take out the angle brackets. If the path you have there is correct, it will look like this:
export NXJ_HOME="/opt/LeJOS_NXJ_0.9.1beta-3"

The programs lejos uses need to be in a place where the operating system will know to look for them. To tell it to look in the right directory, you add that directory to the PATH variable. To do this, add a new line like this exactly:
export PATH="${PATH}:${NXJ_HOME}/bin"

This means to change the PATH variable to equal what it used to be, followed by a colon and the bin directory in the directory NXJ_HOME. The colon is used to separate this directory from the last directory that was in the PATH variable. You may need to restart your computer for these to take effect.
foliot
New User
 
Posts: 17
Joined: Fri Mar 16, 2012 10:21 pm

Re: Environment Setup Help

Postby napti » Thu Jul 26, 2012 5:41 pm

Ok, so I followed the instructions you gave me and I think they worked because now if I go into eclipse and go to LeJOS NXJ> Upload firmware it actually launches the nxjflashg instead of coming up with an error saying the NXT_Home is not in the PATH. I tried moving onto the next step in the tutorial (same as the one posted above: http://lejos.sourceforge.net/nxt/nxj/tu ... dLinux.htm) which is building the release to get the USB Communications working. I went to change directory to $NXJ_HOME/build and typed ant like it specified. I got this error:


pti@pti-desktop:/opt/leJOS_NXJ_0.9.1beta-3/build$ ant
Buildfile: build.xml

jlibnxt:

clean:

jlibnxt:

BUILD FAILED
/opt/leJOS_NXJ_0.9.1beta-3/build/build.xml:87: The following error occurred while executing this line:
/opt/leJOS_NXJ_0.9.1beta-3/build/libnxt/build.xml:39: Can't create history file

Total time: 0 seconds
pti@pti-desktop:/opt/leJOS_NXJ_0.9.1beta-3/build$


So I guess this means it was unable to create the build.xml? I'm not sure as to where to go from here. I have libusb installed (libusb-0.1 not libusb-1.0) so I don't think that is the problem....


Anyways, thank you for your thorough answer to my previous question, it is much appreciated!
napti
New User
 
Posts: 3
Joined: Mon Jul 23, 2012 2:34 pm

Re: Environment Setup Help

Postby skoehler » Thu Jul 26, 2012 6:06 pm

User pti doesn't have write permission in /opt/leJOS_NXJ_0.9.1beta-3/build/ it seems.
Try using "sudo ant" instead of just "ant".
skoehler
leJOS Team Member
 
Posts: 1112
Joined: Thu Oct 30, 2008 4:54 pm

Re: Environment Setup Help

Postby napti » Fri Jul 27, 2012 1:38 pm

I got it working! Thank you!
napti
New User
 
Posts: 3
Joined: Mon Jul 23, 2012 2:34 pm

Re: Environment Setup Help

Postby epascual » Sun Jul 29, 2012 9:07 pm

Rather than using sudo, which should be used only when one needs to change something in the system, it would be IMHO preferable to give write access to user pti to the directory (and sub-dirs) in which LeJOS has been installed. This makes sense since you (user "pti" I guess) are the only one user and the system maintainer of LeJOS on your system.
Eric PASCUAL - POBOT association VP & co-founder - http://www.pobot.org
epascual
Novice
 
Posts: 27
Joined: Sun Jan 17, 2010 12:15 am
Location: Sophia-Antipolis (France)

Re: Environment Setup Help

Postby skoehler » Sun Jul 29, 2012 9:10 pm

epascual wrote:Rather than using sudo, which should be used only when one needs to change something in the system, it would be IMHO preferable to give write access to user pty to the directory (and sub-dirs) in which LeJOS has been installed. This makes sense since you (user "pty" I guess) are the only one user and the system maintainer of LeJOS on your system.

That's rubbish. "sudo ant" is only needed once, cause it creates some dynamic libraries. It's part of the installation process, which should be performed as root. The user pty will not need write permission to the directory and subdirectories in which leJOS has been installed at any point in the future.
skoehler
leJOS Team Member
 
Posts: 1112
Joined: Thu Oct 30, 2008 4:54 pm

Re: Environment Setup Help

Postby epascual » Sun Jul 29, 2012 9:37 pm

Ahem... I find "rubbish" a bit rude as a comment :?

As I wrote, it was just "my humble opinion". Everybody is free to agree or not, without any need to be so aggressive. My experience is that I have needed to do some modifications in the LeJOS tree at the time I was playing with it, changing some bits in classes for instance. Typing "sudo" quickly became boring, and BTW a bit dangerous if you slip on the keyboard and just issue a wrongly rooted "rm" for instance.

But once again, it was just my humble feedback. Nothing more.
Eric PASCUAL - POBOT association VP & co-founder - http://www.pobot.org
epascual
Novice
 
Posts: 27
Joined: Sun Jan 17, 2010 12:15 am
Location: Sophia-Antipolis (France)

Re: Environment Setup Help

Postby skoehler » Sun Jul 29, 2012 9:52 pm

epascual wrote:But once again, it was just my humble feedback. Nothing more.

Sorry for calling it "rubbish". It was wrong nonetheless.
skoehler
leJOS Team Member
 
Posts: 1112
Joined: Thu Oct 30, 2008 4:54 pm

Re: Environment Setup Help

Postby epascual » Mon Jul 30, 2012 3:06 pm

OK. Excuses accepted ;)
Eric PASCUAL - POBOT association VP & co-founder - http://www.pobot.org
epascual
Novice
 
Posts: 27
Joined: Sun Jan 17, 2010 12:15 am
Location: Sophia-Antipolis (France)


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff