First time here? Check our help page!
1

Problems with adding new java actors with external dependencies

I am trying to add a new java Actor to an existing example model. This actor would use a jar file that has already been added to BCVTB/lib directory. Also, myActor.class is added to myActors/ directory.

There is a xml file that points to the myActor.class. When I try to load the xml file in BCVTB, I get an error indicating that some class files cannot be located in the jar files.

However, as soon as I remove the dependencies to the jar package from the java class, the new actor can be created and used in BCVTB.

Any suggestions on fixing the problem is much appreciated. Am not putting the jar files in the right place?

Paris's avatar
11
Paris
asked 2017-02-15 21:34:17 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-04-13 16:43:14 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

The answer depends on how you invoke BCVTB. This is really a question about the Java Classpath. Usually, when the java process is invoked, the -classpath argument is used to set the classpath. If the value of the classpath includes a directory with a *, then all the jar files in that directory are included.

Under MacOSX, if I invoke BCVTB with:

cd $PTII
java -classpath '.:./lib/*' ptolemy.vergil.VergilApplication -bcvtb

Then, if I do

  1. File -> New -> Graph Editor
  2. View ->JVM Properties

Then java.class.path will have all the jar files in $PTII/lib

Note that under Mac and Linux, the separator between path elements is a colon. Under Windows, it is a semicolon.

See

https://docs.oracle.com/javase/8/docs...

https://docs.oracle.com/javase/8/docs...

https://chess.eecs.berkeley.edu/ptext...

cxbrooks's avatar
30
cxbrooks
answered 2017-10-31 13:00:32 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments