We tried implemting the "Add Field" example ( https://www.chemaxon.com/instantjchem/ijc_latest/docs/developer/api/examples/addfield/index.html ). Everything went fine until we got to the "Create the Field" section: Netbeans complains that the UIBackgroundRunner instance has no start() method. This method should be implemented in the superclass (BackgroundRunner), but this is not present in the package (com.im.commons.progress in the com-im-commons.jar).
We suspect that using BackgroundRunner is deprecated. Can someone provide updated code for this example? We suspect one should use some combination of EnvUtils and DFFeedback, but since we're only learning to hack Instant JChem, we don't really have a clue how to do this.
Thanks a lot in advance!
We have tested this API example and it seems to be correct and works properly. Possibly there might be some configuration problems. What NetBeans and IJC versions do you use for development? IJC 5.3.4 should work correctly with NetBeans 6.7.1 (this NetBeans platform was used as basement for all IJC 5.3.x).
A few more comments:
- None of BackgroundRunner, UIBackgroundRunnerRW and UIBackgroundRunnerRO are deprecated. They are frequently used in IJC codebase
- BackgroundRunner has start() method implemented
- BackgroundRunner is in com.im.commons.progress package (com-im-commons-nbcommons.jar)
- UIBackgroundRunnerRW/RO are in com.im.df.util package (com-im-df.jar)
API examples web pages should be up-to-date, but in the case there are some differences it is better to use sources directly. Unfortunately I just found out that example download link is broken at chemaxon.com web. We are going to fix this soon, but you can use the attached zip in the meantime.
Thanks for the quick reply. The problem was indeed configuration-dependent. We did not include com-im-commons-nbcommons.jar in the dependencies.
The problem is that the dependency selection dialogue on Netbeans 6.9 (which we're using) shows considerably more libraries than depicted in the example on the web (screenshot attached). So we had to guess which libraries are required, and we missed the nbcommons stuff. Adding it to the dependencies fixed the problem.
However, now netbeans complains that createTask() has protected access in com.im.df.util.UIBackgroundRunnerRW. Further, it complains that UIBackgroundRunnerRW does no have a method "getEnvironment".
I guess these problems are all somehow related to dependency resolution. Is it probably not a good idea to use Netbeans 6.9 for development, but should we rather use 6.7.1 for everything?
Thanks in advance,
I tested the example again and did some changes in the project configuration. We need to update this at web as well. Now it works with NetBeans 6.9 + JDK 1.6 + IJC 5.3.4 (as platform).
You need to go to Tools-> NetBeans Platforms and add IJC 5.3.4 (as described in example documentation).
Then you can open the Add field project (attached), go to its options and select this IJC 5.3.4 as a base platform for this module. Add field project should be now compliable without any warning and able to run properly.