I am scripting Java via Rhino, and I would like to use the JCodec library. I put the jcodec-0.1.9.jar
file in the same directory, and I added it via -cp
on the command-line. The command to invoke Rhino looks like:
java -cp "rhino-1.7.7.1.jar;jcodec-0.1.9.jar;." org.mozilla.javascript.tools.shell.Main -opt 9 js/main.js %*
However, the library doesn't load at all, since all of its classes remain undefined. For example, running:
print(java.lang.Class.forName('org.jcodec.api.awt.SequenceEncoder'))
throws a ClassNotFoundException
, while it doesn't for say, 'javax.swing.JFrame'
.
I feel like I'm not including it correctly, but everywhere I've looked, this seems to be the way. Anyone have any suggestions?
try the following to make sure that the current directory is in your classpaht:
java -cp ".\rhino-1.7.7.1.jar;.\jcodec-0.1.9.jar;." org.mozilla.javascript.tools.shell
Note: if you're on UNIX change the .\\ to ./ and the ; to :
The class you are trying to reference does not have an 'awt' in it. Should be:
org.jcodec.api.SequenceEncoder
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.