Installing leJOS NXJ for Lego Mindstorm

I was trying to install leJOS to my Lego minstorm brick. I used ubuntu and got into trouble when I tried to flash the lego brick. I realized that the problem is that I didn’t have write permission to usb device. If I used sudo, I didn’t know how to export the environment variable NXJ_HOME….