To get JavaGD working in a non-Maven environment is difficult enough. More difficulties arise with the use of Maven. Maven is usually very helpful when dealing with external libraries. The problem is that the necessary jars are not available in an official Maven repository (not fully true, see last remark). To get the Java bridge run you need to add these jars manually to Maven:
Find the necessary jars
It is not recommended to simply download the jars from the internet and add them to Maven. It is preferrable to install the javagd module in R first. Then you can find the first three jars commonly in:
The javaGD.jar in:
Manually add jars to the Maven dependencies
This is quite simple: navigate to ‘dependencies’, chose ‘add dependency’, enter more or less correct details. Then right-click the new dependency and chose ‘manually install artifact’. Here you can navigate to the locations you found above and add the jars.
You may find more details how to do this here.
If you’re annoyed by warnings you can cure them with this advice here.
Check the following steps:
- Adapt netbeans.conf.
- Properties -> Actions -> ‘Run projects’: Add to exec.args
- Add the same to exec.args for Properties -> Actions -> ‘Run file via main()’
- Check your source code: “You must specify a correct direction to the the class which implements all gdXXX methods and constructors of org.rosuda.JavaGD.JavaGD and the class name must be in fully-qualified JNI notation. If the class is part of a package (e.g. my.package), this should be set to:”
If you now run your program and you get a class path exception this will be caused by wrong ‘-Djava…’. If you get a strange graphic behaviour this will be caused by a wrong direction to the the class which implements all gdXXX methods.
Hopefully once you can find the jars in a public Maven repository and add them easily.
Found, but not checked: