Nxjc error

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

Moderators: 99jonathan, roger, imaqine

Nxjc error

Postby nat1 » Mon Sep 10, 2007 1:53 am

Hi there!

I've been trying to set up leJOS for the past week and I got the firmware downloaded!! But when I go to use the nxjc command i get
"'javac' is not recognized as an internal or external command,
operable program or batch file"
I have no clue what to do!! If someone could help that would be great!!
BTW I am using v. 0.4.0, and I'm running win xp.
Thanks!

Nat
nat1
Novice
 
Posts: 79
Joined: Mon Sep 10, 2007 1:21 am
Location: n/a

Postby 99jonathan » Mon Sep 10, 2007 2:26 am

do you have the jdk installed and the JAVA_HOME variable set properly?
99jonathan
Moderator
 
Posts: 122
Joined: Thu Mar 01, 2007 5:30 am

nxjc error

Postby manticore » Mon Sep 10, 2007 4:54 am

I have had the same problem. Comparing the .bat with the the 0.3 release there are missing " " around the "%NXJ_HOME%\lib\classes.jar;%CLASSPATH%"
That solved my problem with the javac
manticore
New User
 
Posts: 1
Joined: Mon Sep 10, 2007 4:50 am

Postby nat1 » Mon Sep 10, 2007 10:45 pm

hi

Yes I do hava the jdk and JAVA_HOME set up corectly. Manticore, can you give me more detail about the " ".
Thanks!

Nat
nat1
Novice
 
Posts: 79
Joined: Mon Sep 10, 2007 1:21 am
Location: n/a

Possible Help

Postby jvance » Tue Sep 11, 2007 12:40 am

Hi,
Maybe this will help you. Is the bin directory in your path? If the bin directory of the jdk is not in my path I get the exact same result.
Hope this helps
V
jvance
New User
 
Posts: 22
Joined: Sun Aug 12, 2007 2:22 am

Postby nat1 » Tue Sep 11, 2007 9:33 pm

hi

I found out last night that I can download files :D :D . But when I go to download files that don't hava a class file I get a CLASSPATH error. So the problem is in the variables, if somone could post their PATH,CLASSPATH, or any other variable the involes nxj that wolud be great.
Thanks!

Nat
nat1
Novice
 
Posts: 79
Joined: Mon Sep 10, 2007 1:21 am
Location: n/a

Postby NVRAM » Thu Sep 13, 2007 5:57 am

nat1 wrote:But when I go to use the nxjc command i get
"'javac' is not recognized as an internal or external command,
operable program or batch file"

You must have the JDK bin directory in your Path environment variable, and apparently you don't. BTW, after you change the settings in the
environment variables, you'll need to restart Eclipse (or command console or other app) to inherit the new settings.
nat1 wrote: I found out last night that I can download files :D :D . But when I go to download files that don't hava a class file I get a CLASSPATH error. So the problem is in the variables,


The problem is in the scripts. There was a problem using directories with spaces, and I suggested a patch but apparently wasn't completely clear.
I don't have an MSW machine at home to test this, unfortunately.

Essentially, my suggestion is either:
0.3.0 -- Remove all quotes from variable assignment (SET) lines.
0.4.0 -- Add quotes around all parameters with a percent sign on any START, java or javac lines. See below for a unified diff listing.

Sorry for the confusion, could someone (with spaces in your CLASSPATH or NXJ_HOME path) try this?

NVRAM
Code: Select all
===========================================================
--- lejosfirmdl.bat~   2007-09-02 23:07:04.000000000 -0600
+++ lejosfirmdl.bat   2007-09-14 00:31:29.000000000 -0600
@@ -21,7 +21,7 @@
 
 :INSTALL
 echo LIBUSB not installed. Running setup program...
-START "LIBUSB INSTALLER" /wait %NXJ_HOME%\3rdparty\lib\libusb-win32-filter-bin-0.1.12.1.exe
+START "LIBUSB INSTALLER" /wait "%NXJ_HOME%\3rdparty\lib\libusb-win32-filter-bin-0.1.12.1.exe"
 echo NOTE: If you encounter the error NXT Not Found, reboot your computer, make sure the brick is still in firmware upload mode, and try again.
 
 :MAIN
===========================================================
--- nxj.bat~   2007-09-02 23:07:04.000000000 -0600
+++ nxj.bat   2007-09-14 00:29:29.000000000 -0600
@@ -4,7 +4,7 @@
 set THIRDPARTY_LIBS=%NXJ_HOME%\3rdparty\lib
 set LINK_CLASSPATH=.;%THIRDPARTY_LIBS%\bcel-5.1.jar;%THIRDPARTY_LIBS%\commons-cli-1.0.jar;%NXJ_HOME%\lib\pctools.jar;%NXJ_HOME%\lib\pccomm.jar;%NXJ_HOME%\lib\jtools.jar;%THIRDPARTY_LIBS%\bluecove.jar;%NXJ_HOME%\lib\classes.jar
 
-java -Djava.library.path=%NXJ_HOME%\bin -Dnxj.home=%NXJ_HOME% -classpath %LINK_CLASSPATH% lejos.pc.tools.NXJLinkAndUpload --writeorder LE --classpath %LINK_CLASSPATH% %*
+java "-Djava.library.path=%NXJ_HOME%\bin" "-Dnxj.home=%NXJ_HOME%" -classpath "%LINK_CLASSPATH%" lejos.pc.tools.NXJLinkAndUpload --writeorder LE --classpath "%LINK_CLASSPATH%" %*
 
 goto end
 
===========================================================
--- nxjc.bat~   2007-09-02 23:07:04.000000000 -0600
+++ nxjc.bat   2007-09-14 00:29:52.000000000 -0600
@@ -1,7 +1,7 @@
 @echo off
 if "%NXJ_HOME%" == ""  goto homeless
 
-javac -source 1.3 -target 1.1 -bootclasspath %NXJ_HOME%\lib\classes.jar;%CLASSPATH% %*
+javac -source 1.3 -target 1.1 -bootclasspath "%NXJ_HOME%\lib\classes.jar;%CLASSPATH%" %*
 goto end
 
 :homeless
===========================================================
--- nxjlink.bat~   2007-09-02 23:07:04.000000000 -0600
+++ nxjlink.bat   2007-09-14 00:30:09.000000000 -0600
@@ -4,7 +4,7 @@
 set THIRDPARTY_LIBS=%NXJ_HOME%\3rdparty\lib
 set LINK_CLASSPATH=.;%THIRDPARTY_LIBS%\bcel-5.1.jar;%THIRDPARTY_LIBS%\commons-cli-1.0.jar;%NXJ_HOME%\lib\jtools.jar;%NXJ_HOME%\lib\classes.jar
 
-java -classpath %LINK_CLASSPATH% js.tinyvm.TinyVM --writeorder LE --classpath %LINK_CLASSPATH% %*
+java -classpath "%LINK_CLASSPATH%" js.tinyvm.TinyVM --writeorder LE --classpath "%LINK_CLASSPATH%" %*
 goto end
 
 :homeless
===========================================================
--- nxjupload.bat~   2007-09-02 23:07:04.000000000 -0600
+++ nxjupload.bat   2007-09-14 00:30:38.000000000 -0600
@@ -3,7 +3,7 @@
 
 set THIRDPARTY_LIBS=%NXJ_HOME%\3rdparty\lib
 
-java -Djava.library.path=%NXJ_HOME%\bin -Dnxj.home=%NXJ_HOME% -classpath %THIRDPARTY_LIBS%\bcel-5.1.jar;%THIRDPARTY_LIBS%\commons-cli-1.0.jar;%NXJ_HOME%\lib\pctools.jar;%NXJ_HOME%\lib\pccomm.jar;%NXJ_HOME%\lib\jtools.jar;%NXJ_HOME%\3rdparty\lib\bluecove.jar lejos.pc.tools.NXJUpload %*
+java "-Djava.library.path=%NXJ_HOME%\bin" "-Dnxj.home=%NXJ_HOME%" -classpath "%THIRDPARTY_LIBS%\bcel-5.1.jar;%THIRDPARTY_LIBS%\commons-cli-1.0.jar;%NXJ_HOME%\lib\pctools.jar;%NXJ_HOME%\lib\pccomm.jar;%NXJ_HOME%\lib\jtools.jar;%NXJ_HOME%\3rdparty\lib\bluecove.jar" lejos.pc.tools.NXJUpload %*
 goto end
 
 :homeless
NVRAM
New User
 
Posts: 17
Joined: Tue Aug 21, 2007 5:25 am

Postby nat1 » Sat Sep 15, 2007 6:25 pm

hi

I got nxjc to work but when I try to cmpile the helloworld sample I get a error that says that there is no source files. what am I doing wrong?thanks for all the help! :D
Thanks!

Nat
nat1
Novice
 
Posts: 79
Joined: Mon Sep 10, 2007 1:21 am
Location: n/a

Postby roger » Sun Sep 16, 2007 3:26 am

Hi Nat,
I would like to help, but I need to more about exactly what are you doing.
Did you succeed with the Compiling and running your first code instructions in README? If not, exactly what error messages did you get? in response to what commands?
roger
Moderator
 
Posts: 350
Joined: Fri Jun 01, 2007 4:31 am
Location: Berkeley, CA

Postby nat1 » Sun Sep 16, 2007 8:04 pm

hi


For some reason everything works now :D :D . No clue why it did'nt work last night, anyway GOOD BY NXTG :D :D :D !!!
Thanks!

Nat
nat1
Novice
 
Posts: 79
Joined: Mon Sep 10, 2007 1:21 am
Location: n/a

same error

Postby charlesp » Tue Oct 30, 2007 2:37 am

I was getting the same error and my variables are set right for leJos and JDK and they are both in my path. For some reason I quit getting the error but it still will not compile. I would really like to be able to compile on my home machine and not have to wait for the next class to compile my code Thanks for any help
charlesp
New User
 
Posts: 2
Joined: Tue Oct 30, 2007 1:43 am

Postby bbagnall » Sun Nov 04, 2007 7:27 pm

How do you know it doesn't compile? If you don't get an error that should mean that it produced a .class file in your directory. Then use NXJ to link and upload the code to your NXT brick.
User avatar
bbagnall
Site Admin
 
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Compilation Problem

Postby pmig26 » Sun Nov 04, 2007 9:48 pm

When i entered nxjc Tune.java appears the following:

javac: invalid flag:

Someone has the same error?
pmig26
New User
 
Posts: 1
Joined: Sun Nov 04, 2007 9:42 pm
Location: LIMA, PERU

Same error

Postby Jochi » Tue Nov 06, 2007 8:25 pm

I have been having the exact same problem. I am pretty sure my system variables are set correctly and I am able to compile normal java files using javac. However using lejosjc or nxjc to compile the Tune.java file or the R2MeToo.java file used in the Maximum NXT book just throws up the error: -

javac: invalid flag: C:\Program Files\Java\lejos_nxj\lib\classes.jar;
Usage: javac <options> <source files>
use -help for a list of possible options

I am using leJOS on the NXT for my final year University project but seem to be falling at the first hurdle! So any help would be greatly appreciated :)

Thanks,
Jochi
User avatar
Jochi
Novice
 
Posts: 26
Joined: Tue Nov 06, 2007 8:17 pm
Location: Guildford, UK

Postby lawrie » Tue Nov 13, 2007 12:13 am

The easiest solution is to reinstall lejos in a directory without spaces in its name, i.e not in Program Files. There is a bug in the nxjc and other scripts as NVRAM explained.
lawrie
leJOS Team Member
 
Posts: 842
Joined: Mon Feb 05, 2007 1:27 pm

Next

Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 2 guests

more stuff