To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 2592
2591  |  2593
Subject: 
Re: a problem ... need some help !
Newsgroups: 
lugnet.robotics.rcx
Date: 
Sun, 6 Feb 2005 05:09:22 GMT
Viewed: 
5538 times
  
In lugnet.robotics.rcx, tata sharfi wrote:
hi,,,
thanks, i just defined JAVAC to where my javac is and its working but there is a
small problem that i have to put the java file im compiling in lejos\bin because
it doesn't work when i set the CLASSPATH !
i also defined JAVA env var to $jdk\bin\java so that the lejos command would
work.

Although you may not be using BricxCC to compile your leJOS code I think it
might be instructive to describe how BricxCC manages to compile leJOS code
properly.  The way BricxCC works with leJOS is to create a very simple makefile
that launches lejosc, lejos, and lejosrun as needed to compile, link, and
download the program to the brick.  Here's what that makefile looks like:

ROOT=/lejos
LEJOSC=$(ROOT)/bin/lejosc
LEJOS=$(ROOT)/bin/lejos
LEJOSRUN=$(ROOT)/bin/lejosrun
CLASSPATH=.
JAVAC=C:\j2sdk1.4.2_07/bin/javac
DOBJECTS=
PROGRAMS=HelloWorld

.EXPORT_ALL_VARIABLES :

all:: $(DOBJECTS) $(PROGRAMS).bin

download:: all
$(LEJOSRUN) --tty=usb $(PROGRAMS).bin

# how to compile Java source
%.class: %.java
$(LEJOSC) -target 1.1 $<

# how to link Java class files
%.bin: %.class $(DOBJECTS)
$(LEJOS) $* -o $@


You may note that this makefile sets CLASSPATH equal to "." (dot).  This enables
lejosc and lejos to compile and link whatever .java files are needed from the
current directory.  I'm fairly confident that if you were to set your CLASSPATH
to this same value (dot) then you would not need to copy your .java file into
the lejos/bin directory.

If you are running a Windows operating system and you want to use brickOS or
leJOS then I highly recommend developing within BricxCC rather than some other
tool (such as notepad and a command prompt).

I did, however, run into another little quirk in BricxCC tonight.  I usually set
the "-q" switch with the NQC and LCC (MindScript & LASM) compilers to quiet them
down a bit.  This switch can be added to the compiler command line by putting
"-q" into the Switches field on the compiler-specific tab or by putting it on
the Common tab.  Unfortunately, the "-q" switch when passed to make means
"question" rather than "quiet" and it causes make to not actually execute any
commands.  Since I had set this switch on the Common tab none of my .java or
.cpp code was compiling anymore.  The moral of this story is that you should put
the "-q" switch on the NQC and LCC tabs if you want those compilers to be quiet
but do not put it in the Switches field on the Common tab.

John Hansen



Message is in Reply To:
  Re: a problem ... need some help !
 
hi,,, thanks, i just defined JAVAC to where my javac is and its working but there is a small problem that i have to put the java file im compiling in lejos\bin because it doesn't work when i set the CLASSPATH ! i also defined JAVA env var to (...) (20 years ago, 5-Feb-05, to lugnet.robotics.rcx)

4 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR