This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I want to convert my bar chart which I made in Jfreechart into a .jpeg file. I did some R&D and found this --
However When ever I try to run this code. Both gives me this error --
BarExample.java:35: cannot find symbol
symbol : class FileOutputStream/File
location: class BarExample
1.6.0_16/bin/chart.jpg"), chart, 400, 350);
Also the path we give here is the place and name of the file where it should be stored, right?? Where Am I going wrong??
Noopur Kore wrote:These are all libraries i imported. which is the one for FileOutputStream??
None of them import FileOutputStream. Have a look at the API documentation (just follow the link from FileOutputStream which will take you directly there) and you'll see what package it's in.
Or is it giving me a problem because I'm trying to display the chart and save it at the same time??
The compiler message says it can't find the symbol "FileOutputStream". That's all it says. The compiler has no idea what any of those classes do or what they are for, so it can't possibly know that there are "charts" involved and that you are trying to "display" the chart or anything of that kind. All it knows is symbols. So when you see an error message, just focus on what it actually says. Don't try to invent meanings for what it says, especially meanings like that one.