Reputation: 645
I am having a few issues setting up javaplot into my application.
I have downloaded the source files from: http://sourceforge.net/projects/gnujavaplot/files/latest/download
and i have dragged the .jar package into the default java libraries folder /Library/Java/Home/lib/ext (i am running mac os x 10.7)
after following the instructions on the web site i have the following program
import com.panayotis.gnuplot.JavaPlot;
public class Test {
public static void main(String[] args) {
JavaPlot p = new JavaPlot();
p.addPlot("sin(x)");
p.plot();
}
}
which compiles fine but when i try to run the program i get the following error:
Exception in thread "main" com.panayotis.gnuplot.GNUPlotException: GnuPlot executable
"gnuplot" not found. Please provide gnuplot path to the constructor of GNUPlot.
at com.panayotis.gnuplot.GNUPlot.<init>(GNUPlot.java:161)
at com.panayotis.gnuplot.GNUPlot.<init>(GNUPlot.java:58)
at com.panayotis.gnuplot.JavaPlot.<init>(JavaPlot.java:31)
at Test.main(Test.java:4)
Could anyone shed any light on this error? Any help would be great thanks
Leo
Upvotes: 1
Views: 2907
Reputation: 2847
i had the same problem. This problem was, because "gnuplot" was not in my macOS. So, you can install with the MacPorts. http://guide.macports.org And, then:
sudo port selfupdate
sudo port install gnuplot
and wait.... when finished the process, you can run de JavaPlot.
Upvotes: 1
Reputation: 1542
Take a look at the Javadoc documentation in the Javaplot sources. It states that Javaplot needs the gnuplot binary installed on your system. As the error message you are getting says, you must provide the path to gnuplot to your constructor. Apparently, the automatic search for it does not succeed -- this may either mean that there is no gnuplot installation on your system, or that you installed it in a nonstandard location.
The Javaplot source also contains this constructor, which allows passing the path:
/**
* Create a new JavaPlot object with a given gnuplot path
* @param gnuplotpath
* @throws com.panayotis.gnuplot.GNUPlotException If the gnuplot executable is not found, this exception is thrown. It means that the
* provided path for gnuplot is not valid.
* @see GNUPlot#GNUPlot(String)
*/
public JavaPlot(String gnuplotpath) throws GNUPlotException {
super(gnuplotpath);
}
You can find out where gnuplot is installed on your system by using the command which gnuplot
in a bash console.
Upvotes: 2