Question-and-Answer Resource for the Building Energy Modeling Community
Get s tarted with the Help page
Ask Your Question
1

Problems with adding new java actors with external dependencies

asked 2017-02-15 21:34:17 -0500

Paris gravatar image

updated 2017-04-13 16:43:14 -0500

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-10-31 13:00:32 -0500

cxbrooks gravatar image

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...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

 

Question Tools

Stats

Asked: 2017-02-15 21:34:17 -0500

Seen: 63 times

Last updated: Feb 16 '17