ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  how to use chartdirector in java
Posted by SURESH on Mar-22-2012 15:46
hi,

I am new to this chartdirector so I want to know what are the steps should I follow so that
I could run chartdirector files/programs through my java program. I put the entire
chartdirector folder in the bin folder of jdk1.6.0 and tried to run my java program which
internally  makes use of this chartdirector and its related files by importing them like
ColorAxis, ContourLayer, XYChart etc but the compiler is not identifying this folder at all.

Plz anybody help

  Re: how to use chartdirector in java
Posted by Peter Kwan on Mar-23-2012 01:52
Hi SURESH,

ChartDirector.jar or ChartDirector_s.jar can be used just like any other JAR file. You just need to include them in your Java classpath directory. For example, you can use the -classpath flag when starting the Java compiler or runtime, or you can put them in a the JAR directory normally searched by your Java complier or runtime (in many Java VM, there is a directory "jre/lib/ext" for that purpose). In the installation section of the ChartDirector documentation, there is an example of how to compile and run the sample code, using the -classpath flag, like:

javac -classpath "ChartDirector_s.jar;." ChartDirectorDemo.java
java -classpath "ChartDirector_s.jar;." ChartDirectorDemo

You may refer to the Java documentation for more details on how to use the -classpath command line flag or which directories should be should to store JAR files.

If you are using a integrated development environment (IDE), some of them allows you to configure third party JAR files. Please refer to the documentation of the IDE for details.

Hope this can help.

Regards
Peter Kwan

  Re: how to use chartdirector in java
Posted by suresh on Mar-27-2012 18:48
Still I am not getting how to run chartdirector demo programs in java.

I copied one of the programs from javademo folder and placed it in jdk1.6.0/bin folder. I also placed jar files you mentioned in the reply in the jre/lib/ext folder.
Then I tried to compile that program but compiler is not identifying classes of chartdirector

So what should I do so that java compiler identifies chartdirector and all its classes or functions.

Please explain the steps in detail.

  Re: how to use chartdirector in java
Posted by Peter Kwan on Mar-27-2012 23:27
Hi suresh,

Please go to the command prompt, change to the javademo directory, and enter the command to compile and run the program as mention in the Installation section of the ChartDirector documentaton:


cd \\mypath\\ChartDirector\\javademo
javac -classpath "ChartDirector_s.jar;." ChartDirectorDemo.java
java -classpath "ChartDirector_s.jar;." ChartDirectorDemo


If the above still cannot solve the problem, would you mind to inform me the exact output (the error message) you see?


Regards
Peter Kwan

  Re: how to use chartdirector in java
Posted by Peter Kwan on Mar-27-2012 23:30
Hi suresh,

One more thing. The command I mentioned in my last message assumes you are on Windnows. If you are on Linux/UNIX, please use:

cd /mypath/ChartDirector/javademo
javac -classpath ChartDirector_s.jar:. ChartDirectorDemo.java
java -classpath ChartDirector_s.jar:. ChartDirectorDemo

Also, the "mypath" above refers to the directory that you have unzip or unjar ChartDirector to. Please modify it to the actual path you are using.

Hope this can help.

Regards
Peter Kwan