开云体育

Locked Compilling and running JMRI


sixth_rule
 

i downloaded Jbuilder
and got the zip file on the sourceforge pagei loaded up the code and
hit the run button and i get 5 erros
all involving this line

static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance(LocoNetMessage.class.getName());

Chad Spickett


 

At 3:26 AM +0000 8/10/02, sixth_rule wrote:
i downloaded Jbuilder
and got the zip file on the sourceforge pagei loaded up the code and
hit the run button and i get 5 erros
all involving this line

static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance(LocoNetMessage.class.getName());
I just tried it from scratch to see if I could reproduce your problem. The steps are:

download & unzip the jb1.0.3.zip file; that created a jb1.0.3 directory

cd jb1.0.3/java

jbuilder jmri.jpx
(This opened the JBuilder window with a tree of files, etc,
displayed down the left side)

click "rebuild" icon (little wheel with an arrow pointing
to 1's and 0's)

This gave warnings because of the filenames of certain files having been changed. I don't know whether this happened in the upload or in the download. The files it complained about are:

./test/jmri/jmrit/symbolicprog/CombinedLocoSelListP#52D2B.java
which needs to be renamed to:
./test/jmri/jmrit/symbolicprog/CombinedLocoSelListPaneTest.java

./src/jmri/configurexml/AbstractTurnoutManag#52982.java
which needs to be renamed to:
./src/jmri/configurexml/AbstractTurnoutManagerConfigXML.java

./src/jmri/jmrix/loconet/configurexml/LnSecurityElementMan#52B50.java
which needs to be renamed to:
./src/jmri/jmrix/loconet/configurexml/LnSecurityElementManagerXml.java

./test/jmri/jmrix/easydcc/EasyDccTrafficContro#52D5B.java
which needs to be renamed to:
./test/jmri/jmrix/easydcc/EasyDccTrafficControlScaffold.java

./test/jmri/jmrix/easydcc/EasyDccTrafficContro#52D5C.java
which needs to be renamed to:
./test/jmri/jmrix/easydcc/EasyDccTrafficControllerTest.java

I don't know what happened to these files, perhaps some filename-length-limit was hit somewhere.

After these are renamed, quit and restart JBuilder (some versions have a "refresh" option under the "Projects" menu that has the same effect). Clicking rebuild then gave me an expected warning about "Deprecated" features being used, and otherwise completed fine. I've uploaded a screenshot of this to the group photos area




From here, it could run DecoderPro, JBuilder, etc just fine.

In summary, I didn't recreate your problem. It would be helpful to have the exact text of the messages. They sound like what you had happening before, when the libraries were not connected. Could you check whether there's a "JMRILibraries.library" in the directory where you start JBuilder? That directory should look like:

[karl:~/Desktop/jb1.0.3/java] jake% ls-F
CVS/ jmri.jpx src/
JMRILibraries.library* jmri.jpx.local test/
classes/ jmri.jpx~*

(src, test, CVS are directories; classes might not be there if you haven't built yet; you also might not have a jmri.jpx~ file)

If that looks OK, I think we'll need to get some help from other people on the list who use Windows machines.

Bob
--
--------------
Bob Jacobsen (Bob_Jacobsen@..., 510-486-7355, fax 510-495-2957)
At CERN until August 10, replies may be slow.


sixth_rule
 

K i did every step the same as you except when i hit rebuild i got
the following errors and no warnings

"LnMessageBuffer.java": Error #: 302 : cannot access class
com.sun.java.util.collections.LinkedList; java.io.IOException: class
not found: class com.sun.java.util.collections.LinkedList at line 11,
column 38

"LnMessageBuffer.java": Error #: 300 : class LinkedList not found in
class jmri.jmrix.loconet.locormi.LnMessageBuffer at line 18, column 3

"LocoNetMessage.java": Error #: 302 : cannot access class
org.apache.log4j.Category; java.io.IOException: class not found:
class org.apache.log4j.Category at line 226, column 29

"LnMessageBuffer.java": Error #: 300 : class LinkedList not found in
class jmri.jmrix.loconet.locormi.LnMessageBuffer at line 28, column 25

"LnTrafficController.java": Error #: 302 : cannot access class
org.apache.log4j.Category; java.io.IOException: class not found:
class org.apache.log4j.Category at line 75, column 26

i also checked in my c:\jb1.0.3\java dir and here is what is there:
classes/
cvs/
doc/
src/
test/
jmri.jpx
jmri.jpx.local
jmri.jpx.local~
JMRILibraries.library

i think the last one was the one you wanted to know if it was there

could there be any class path settings i have wrong or do i have to
move that library file into jdk1.3.1/lib ???


sixth_rule
 

Ok i got rid of the other 3 errors and am now down to these 2

i got rid of the first 3 errors by changing
import com.sun.java.util.collections.linkedlist yo
import java.util.linked list

the lines in question look as follows


Error
"LocoNetMessage.java": Error #: 302 : cannot access class
org.apache.log4j.Category; java.io.IOException: class not found:
class org.apache.log4j.Category at line 226, column 29
corisponds to line

static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance(LocoNetMessage.class.getName());

and Error
"LnTrafficController.java": Error #: 302 : cannot access class
org.apache.log4j.Category; java.io.IOException: class not found:
class org.apache.log4j.Category at line 75, column 26
corrisponds to line

static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance
(LnTrafficController.class.getName());

becasue of the com.sun.java errors i am worried about the org.apache
part of the code becasue that looks like a web adress
also why is it log4j instead of just log ?
i don't see where log4j has been previously declaired
i have been playing around with the wording in this line but have yet
to fix this part

any help would be helpful

Chad Spickett

i also checked in my c:\jb1.0.3\java dir and here is what is there:
classes/
cvs/
doc/
src/
test/
jmri.jpx
jmri.jpx.local
jmri.jpx.local~
JMRILibraries.library

i think the last one was the one you wanted to know if it was there

could there be any class path settings i have wrong or do i have to
move that library file into jdk1.3.1/lib ???


 

At 3:54 PM +0000 8/12/02, sixth_rule wrote:
Ok i got rid of the other 3 errors and am now down to these 2

i got rid of the first 3 errors by changing
import com.sun.java.util.collections.linkedlist yo
import java.util.linked list
Sorry, but this is not progress. The error is because you're not picking up the classes in "collections.jar", which should be in the "lib" directory one level above the "java" directory.

By changing that name, you're using a _different_ class from the Java distribution. It won't interoperate with the serial libraries.

the lines in question look as follows


Error
"LocoNetMessage.java": Error #: 302 : cannot access class
org.apache.log4j.Category; java.io.IOException: class not found:
class org.apache.log4j.Category at line 226, column 29
corisponds to line

static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance(LocoNetMessage.class.getName());

and Error
"LnTrafficController.java": Error #: 302 : cannot access class
org.apache.log4j.Category; java.io.IOException: class not found:
class org.apache.log4j.Category at line 75, column 26
corrisponds to line

static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance
(LnTrafficController.class.getName());

becasue of the com.sun.java errors i am worried about the org.apache
part of the code becasue that looks like a web adress
also why is it log4j instead of just log ?
"log4j" is the name of the package containing the "Category" class. Actually, the complete name of the package is "org.apache.log4j". Those are defined in the "log4j.jar" file in the "lib" directory, which has to be located by the compiler. That's the same problem we're trying to resolve, so hopefully these will all clean up at the same time once we get that.

"log" is a variable that's defined at the bottom of the file. But the _type_ of that variable, e.g. the class info needed by the compiler, has to come from the class definition in a jar file.

i don't see where log4j has been previously declaired
i have been playing around with the wording in this line but have yet
to fix this part

any help would be helpful

Chad Spickett

i also checked in my c:\jb1.0.3\java dir and here is what is there:
classes/
cvs/
doc/
src/
test/
jmri.jpx
jmri.jpx.local
jmri.jpx.local~
JMRILibraries.library

i think the last one was the one you wanted to know if it was there

could there be any class path settings i have wrong or do i have to
> move that library file into jdk1.3.1/lib ???
The "JMRILibraries.library" file is text, and points to the location of the .jar file that JBuilder will use during compilation. It should contain lines like:

<path>[../lib/log4j.jar]</path>

which say that the library "one directory up and then in the lib folder" is needed.

So please check that there's a C:&#92;jn1.0.3&#92;lib directory, and that it contains 7 .jar files, a README file (not needed) and a "security.policy" file (only needed at runtime)

Bob
--
--------------
Bob Jacobsen (Bob_Jacobsen@..., 510-486-7355, fax 510-495-2957)


sixth_rule
 

ok one step foward and 2 back

i do have a jb1.0.3/lib dir and in it is
CVS/
collections.jar
comm.jar
crimson.jar
jdom-jdk11.jar
junit.jar
log4j.jar
Serialio.jar
Readme
security.policy

i also went through all the steps again on my school computer and
came up with the exact same 5 errors

so i am assuming from what you said its just not using the library
correctly

Chad Spickett


 

I downloaded a copy of JBuilder Personal Edition 7 to my son's PC last night, and have been working with it (I can only get to that machine while he's asleep, unfortunately).

The Personal Edition has a couple of limitations that I didn't know about. I think I understand some of them now, though there's still one that needs a workaround.

I've also updated the page on compiling with some instructions on how to get and use CVS. _Please_ do that; this method of passing .zip files, etc, is just not reliable enough to be worth the time.

So the steps I recommend are:

Install CVS - for links, etc please see

Check out a copy of the "jbuilder" module:
create a "project folder"
do the checkout (see the instructions at the link above)

start jbuilder with the jmri.jpx file in the java
folder you just created.

There's one remaining problem, that I hope Alex or somebody can resolve. The personal version of JBuilder apparently gets confused if you have multiple programs to build. So you have to tell it which one to run:

Using the file/folder tree at the upper left, navigate

apps -> DecoderPro -> DecoderPro.java

(or which ever app you want to run, e.g. JMRIdemo.java, LocoTools.java)

Double click that file; it will open to the right.

Right-click on the "DecoderPro" tab at the top of the right
window. (Click would select this, right-click or control-click
brings up a menu)

From the pop-up menu, select "Run".

This tells it that you want to build & run _that_ program, which it then does.


All of the above works for me now. Hopefully it will work for you, and we can resolve the need for that last "click-click-right-click" workaround shortly.

Bob

--
--------------
Bob Jacobsen (Bob_Jacobsen@..., 510-486-7355, fax 510-495-2957)


sixth_rule
 

I actually got it to compile strait up
i went into Tools Configure JDK's and added in the 7 .jar files from
the library

my actual goal in this hole thing is to figure out simply how to make
a java program that
1) acesses the serial ports
2) reads all the loconet packets that come over the system
3) Write packets to the serial ports


 

At 5:28 PM +0000 8/13/02, sixth_rule wrote:

my actual goal in this hole thing is to figure out simply how to make
a java program that
1) acesses the serial ports
2) reads all the loconet packets that come over the system
3) Write packets to the serial ports
Take a look at the jmri.jmrix.loconet.LocoNetInterface and jmri.jmrix.loconet.LocoNetListener interfaces.

Basically, you write a class that implements LocoNetListener, and register it with a LocoNetInterface. Your class will then have its message(...) method called with each LocoNet message that's seen, and will be able to send messages.

For a simple example, you might start by copying the code in the LocoNet turnout implementation, jmri.jmrix.loconet.LnTurnout.

Bob
--
--------------
Bob Jacobsen (Bob_Jacobsen@..., 510-486-7355, fax 510-495-2957)