Deploy jFreeChart app in jar form ->NoClassDefFoundError

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Irv Thomae

Deploy jFreeChart app in jar form ->NoClassDefFoundError

Post by Irv Thomae » Fri May 02, 2003 8:38 pm

There's reason to t hink that this is actually a Java problem, not specific to jFreeCHart, but I'm hoping that someone else has found a reasonable workaround.

I have a jFreeChart application running well on my desktop, and the time has come to see if anyone else can run it too. After bundling all of my class-files into a single jar, and setting a CLASSPATH on a target system to pick up jfreechart and jcommon, this doesn't seem to work:
java -jar MyJFreeApp.jar
It throws java.lang.NoClassDefFoundError:org/jfree/data/time/RegularTimeException

Back-checking, it turns out that the "java -jar" command doesn't even work on the workstation where the jar-file was built!
Searching through Sun's Java site, I find numerous threads with similar complaints. ('Similar' in the sense that classes contained in 3rd-party jar-files aren't found.) Most of them peter out, however, before a satisfactory solution has been described.
Has anyone reading this found a reasonably clean workaround?

Thanks,
Irv Thomae
ISTS/Dartmouth College
Hanover, NH (USA)

leeford
Posts: 1
Joined: Thu Mar 01, 2012 8:42 pm
antibot: No, of course not.

Re: Deploy jFreeChart app in jar form ->NoClassDefFoundError

Post by leeford » Thu Mar 01, 2012 8:49 pm

I am having the same issue. Not sure if adding activity to these threads increases the likelyhood of a useful response or not but I thought it was worth a shot. (Like pushing the elevtator but lots of times)

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Deploy jFreeChart app in jar form ->NoClassDefFoundError

Post by John Matthews » Sat Mar 03, 2012 1:13 am

You have to add the required names to the Class-Path attribute of your JAR's manifest.

Bruce
Posts: 1
Joined: Thu Apr 05, 2012 1:08 am
antibot: No, of course not.

Re: Deploy jFreeChart app in jar form ->NoClassDefFoundError

Post by Bruce » Thu Apr 05, 2012 3:57 am

Thought I'd add my experience with this problem. I got the the error trying to run an eclipse jar file at cmd. The problem is that you can't run the jfreechart and jcommon jar files from within the app jar file (see note in the Java Tutorial refered to by John in previous post). I had to extract the files into the directory where my app jar is located. Using Launch4J worked better because I could include reference to the jfreechart and jcommon jar files in the Classpath tab. PS Love jfreechart! Well done to all contributors.

Locked