Page 1 of 1

how to rebuilt jar files

Posted: Thu Mar 22, 2007 3:58 pm
by manolakis
Hi there!!!
You cant imagine how much i appreciate your reply. The fact is that i have downloaded the jfreechart and jcommon package and i have extracted them. I have placed all of the folders in /JCommon/source/org/jfree in jfreechart-1.0.4/source/org/jfree . To be honest i havent work a lot in my life with packages or jar files in Java. Could you please illustrate me an example of how to rebuilt the jar files myself?

Thanks

Posted: Thu Mar 22, 2007 4:13 pm
by david.gilbert
Don't mix the JCommon and JFreeChart source trees - that just makes things more complicated.

The easiest way to build JCommon and JFreeChart is to use the Ant script included in the distribution (build.xml in the 'ant' subdirectory). You'll need to download and install Apache Ant, if you don't already have it. If you are a Java developer, spending a little time getting familiar with Ant is time well spent - it is used all over the place for building projects.

Both the JCommon and JFreeChart Ant scripts can be run by changing to the 'ant' subdirectory and typing 'ant all'. This will compile the sources, rebuild the jar files, generate the Javadocs etc. By magic.

Posted: Thu Mar 22, 2007 7:29 pm
by manolakis
Ok, now i think that i ve done all that you said. I installed Ant software and i went to 'jfreechart/ant' and used 'ant all' command and the whole package was rebuilt successfully. I did the same for jcommon. But now what comes after that is that i am unable to run the jfreechart-1.0.4.jar file.
BT jfreechart-1.0.4 $ java -jar jfreechart-1.0.4.jar
Failed to load Main-Class manifest attribute from
jfreechart-1.0.4.jar
This is what i get. Is there anything that i am doing wrong? I also put a new demo file in '/org/jfree/chart/demo' where i found it in http://www.java2s.com/Code/Java/Chart/J ... points.htm
What i am interested in is to run that demo. Any idea how i can do that?

Thanks for your time

Posted: Fri Apr 13, 2007 8:22 am
by jwenting
no, there is no main class in the jar. It's not an application you run, but rather a set of classes to use in your own applications.

Posted: Thu Jul 03, 2008 10:37 am
by sacpis
Can anyone help me here?
I have file call first.java which is in path "C:\Java\jfreechart1.0.10\Examples". I have installed jfreechart and jcommon which are in paths "C:\Java\jfreechart1.0.10\jfreechart-1.0.10" and "C:\Java\jfreechart1.0.10\jcommon-1.0.13" respectively.

First.java

package org.jfree;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

public class First {
public static void main(String[] args) {

// create a dataset...
DefaultPieDataset dataset = new DefaultPieDataset();

dataset.setValue("Category 1", 43.2);
dataset.setValue("Category 2", 27.9);
dataset.setValue("Category 3", 79.5);

// create a chart...
JFreeChart chart = ChartFactory.createPieChart(
"Sample Pie Chart",
dataset,
true, // legend?
true, // tooltips?
false // URLs?
);

// create and display a frame...
ChartFrame frame = new ChartFrame("First", chart);
frame.pack();
frame.setVisible(true);
}
}

I'm compiling this file from the path in command line as follows
C:\Java\jfreechart1.0.10\Examples>javac first.java

I'm getting errors. Can anyone help me here?