problem in jar with jfreechart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
charlessouza
Posts: 11
Joined: Tue Mar 09, 2004 9:08 pm
Contact:

problem in jar with jfreechart

Post by charlessouza » Wed May 26, 2004 7:21 pm

I've used the eclipse 2.1.3, and the jfreechart has worked well. I made the executable ylocus.jar and when I try to run it, the error folowing is showed. What I have to do? Am I doing anything worse?


java -cp jcommon-0.9.1.jar; -cp jfreechart-0.9.16.jar; -jar ylocus.jar
java.lang.NoClassDefFoundError: org/jfree/data/XYDataset
at ylocus.YieldLocus.NovoYieldLocus.<init>(NovoYieldLocus.java:54)
at ylocus.YieldLocus.AbrirYieldLocus.<init>(AbrirYieldLocus.java:31)
at ylocus.InterfaceArquivos.<init>(InterfaceArquivos.java:102)
at ylocus.YLocus.abrir(YLocus.java:321)
at ylocus.YLocus.access$3(YLocus.java:320)
at ylocus.YLocus$7.actionPerformed(YLocus.java:134)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:227)
at java.awt.Component.processMouseEvent(Component.java:5093)
at java.awt.Component.processEvent(Component.java:4890)
at java.awt.Container.processEvent(Container.java:1566)
at java.awt.Component.dispatchEventImpl(Component.java:3598)
at java.awt.Container.dispatchEventImpl(Container.java:1623)
at java.awt.Component.dispatchEvent(Component.java:3439)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
at java.awt.Container.dispatchEventImpl(Container.java:1609)
at java.awt.Window.dispatchEventImpl(Window.java:1585)
at java.awt.Component.dispatchEvent(Component.java:3439)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
Terminated with exit code 0

Mimil
JFreeReport Staff Member
Posts: 69
Joined: Tue Mar 25, 2003 7:33 pm

Post by Mimil » Wed May 26, 2004 10:49 pm

Hi,

As i remember good it should be something like that:

Code: Select all

java -cp "jcommon-0.9.1.jar;jfreechart-0.9.16.jar" -jar ylocus.jar 
(without the second -cp and between "")

but didn't you forget to put the jars below? : (it is not for the your current error, but you will get them just after)

gnujaxp.jar
log4j-x.x.x.jar


Bye,
Mimil

charlessouza
Posts: 11
Joined: Tue Mar 09, 2004 9:08 pm
Contact:

Post by charlessouza » Thu May 27, 2004 4:42 am

Code: Select all

java -cp "jcommon-0.9.1.jar;jfreechart-0.9.16.jar" -jar ylocus.jar  
I tried it now, but the same error is showed.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu May 27, 2004 8:33 am

I'm not certain, but I think the -jar option will look for the classpath in the jar's manifest and ignore your -cp setting:

http://home.mindspring.com/~thornton.ro ... ifest.html

So you need to either include the correct classpath in the jar's manifest OR try:

Code: Select all

java -cp jcommon-0.9.1.jar;jfreechart-0.9.16.jar;ylocus.jar your.package.and.class
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

charlessouza
Posts: 11
Joined: Tue Mar 09, 2004 9:08 pm
Contact:

Post by charlessouza » Sat May 29, 2004 10:48 pm

david gilbert, thanks lot, I've found the correct way to make the jar file.

Locked