0

EDIT: After looking into this for several hours I decided to switch to Maven, making this question irrelevant. The switch for my project wasn't too hard for the code, hopefully the last bit stays simple as well. For anyone else having this issue, I suggest you switch to Maven as well if you're trying to use JFreeChart in your Ant-based project. From what I can see it just won't work with Ant.

I've been bashing my head against a proverbial wall trying to work with JFreeChart in my project so I can create charts (bar, pie etc.) using data stored and edited by the program.

What I've done so far is installed the download in my projects libraries through its properties, but with that alone it doesn't know what it is. It seems I need to directly clarify a dependency somehow, but I've seen that in Ant that is somewhat difficult. However, I'm stuck with Ant as too much of the project is already coded in for this instead of something like Maven.

I can supposedly make it work using an ant build script, but I'm not sure where to find this or how to even use it/where to put it etc. I'm currently working on this using NetBeans.

Carey
  • 1
  • 1
  • This isn't 100% related, but maybe the code here can help you figure things out. It has been a minute since I used JFreeChart last. https://stackoverflow.com/q/27008897/2851311. Also, update your question and post your code. It makes things a lot easier when asking for help. Otherwise, the only thing we can do is guess, and that is not helpful. – hfontanez Mar 16 '22 at 00:06
  • What version of JFreeChart are you using? It doesn't seem like the new version has a build.xml file. I think you have to use Maven, but I am not certain. – hfontanez Mar 16 '22 at 00:16
  • Thank you for the advice hfontanez, in the future I will include code. For this problem I didn't think it was relevant because it was a more general question on how to use outside libraries in Ant. As posted in my edit I changed to Maven instead. – Carey Mar 16 '22 at 00:33
  • It's not clear what *specific* problem you were having--setting classpaths in Ant is well-documented; it's no different than using any other library. Transitive dependency management was awful before things like Ivy/etc, and largely irrelevant now because of Maven/Gradle, but there's nothing that prevents using JFreeChart in an Ant project. – Dave Newton Mar 16 '22 at 00:38
  • @DaveNewton If memory serves me well, old versions of JFreeChart did come with a build.xml file which made it much easier to integrate into your Ant projects. That's how it was 8 years ago when I last used it. If you were migrating from an old version to a new version, I can see where anyone could be confused if out of the sudden it doesn't work. I went into their website and of course, now the build.xml seems to be replaced with a pom.xml file. While you are right that nothing prevents the OP to use it wit Ant, it is not as simple as you put it (for the reasons I stated). – hfontanez Mar 16 '22 at 01:37
  • @hfontanez Sure, but it has only a single transitive dep (jcommon) and downloading the jars is straightforward. The OP isn't *building* JFreeChart, they're *using* it, and from there it's the same as using any JAR files. *shrug* – Dave Newton Mar 16 '22 at 02:36
  • @DaveNewton You are referring to a jar file that was last updated in 2014. If you follow the current JFreeChart download link, it will take you to the latest version for which there is no such JAR file. At least not one I could see. If I am incorrect, please point it out because I am confused myself. Here's the link https://www.jfree.org/index.html – hfontanez Mar 16 '22 at 03:26
  • [tag:jfreechart] works well with either [tag:ant] or [tag:maven]. If this is not a duplicate, please [edit] your question to include a [mre] that shows your revised approach. – trashgod Mar 16 '22 at 05:43
  • @hfontanez The jar files are available in the Maven repo; you don't need Maven to download Maven artifacts. The typical approach fon non-/Maven/Ivy/Gradle projects when the jars aren't available directly is to get them from the repo either manually, or with a dummy M/I/G project to get them into the local repo (convenient, especially if there's a complex dependency tree). – Dave Newton Mar 16 '22 at 12:24

0 Answers0