Trouble Compiling

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Mike Keller
Posts: 23
Joined: Mon Jul 06, 2009 12:59 pm

Trouble Compiling

Post by Mike Keller » Wed Dec 15, 2010 6:26 pm

Hey all,

I've been using JFreeChart for a while for a project for a professor at my university. It was all going well, and in fact, I was able to compile this program before. But now he wanted the entire thing deployed to a number of Windows 7 Laptops. I actually was able to move it without recompiling the whole thing (I did have to recompiled the C++ part I used, but that's another matter entirely), but now I have to make a change to it, which is where I am having trouble compililng.

When I try to compile, it gives me errors that it can't find the symbols from the JFreeChart library. I thought that all I had to do was include the .jar files on the classpath, but that isn't working.

Here is line I am using to compile:

Code: Select all

javac -classpath "C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\System Center Operations Manager 2007\;C:\Program Files\java2\modules\ext\swing-worker-1.1.jar;C:\Program Files\java2\modules\ext\appframework-1.0.3.jar;C:\Program Files\java\jdk1.6.0_14\bin\fileiotest; C:\Program Files\jfreechart1.0.13\lib\jcommon1.0.16.jar; C:\Program Files\jfreechart1.0.13\lib\jfreechart1.0.13.jar" FileIOTestApp.java FileIOTestView.java FileIOTestAboutBox.java dllinterface.java
The .java files are all also supposed to be in a package called fileiotest.

I realize that this probably isn't exactly a JFreeChart problem, rather it's a problem with my file structure (I never did understand how to do that with Java), but JFreeChart is the only third party library I use.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Trouble Compiling

Post by skunk » Wed Dec 15, 2010 8:06 pm

Firstly, remove "C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\Adaptec Shared\System;C:\Program Files\System Center Operations Manager 2007\;" from the string as path != classpath.

Secondly, try removing the space characters before the references to jcommon and jfreechart

Also, The reference to "C:\Program Files\java\jdk1.6.0_14\bin\fileiotest;" looks dodgy

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Trouble Compiling

Post by skunk » Wed Dec 15, 2010 10:23 pm

Mike Keller wrote:The .java files are all also supposed to be in a package called fileiotest.
It looks like your source files are not in the right place. In Java, the package structure must have a corresponding directory structure. Your source files must be located in a directory called fileiotest.

For example, if your current directory is C:\mydir
Your sources should be located in C:\mydir\fileiotest

When you compile, your current directory must be C:\mydir and you need to specify the path to the source files in the compile command

Code: Select all

C:\mydir> javac -classpath "mumble, mumble" fileiotest\FileIOTestApp.java fileiotest\FileIOTestView.java fileiotest\FileIOTestAboutBox.java fileiotest\dllinterface.java
After the compile is completed, the class files will all be located in fileiotest just like they have to be in order to match the package structure.

To run your app

Code: Select all

C:\mydir> java -classpath ".;C:\Program Files\jfreechart1.0.13\lib\jcommon1.0.16.jar;C:\Program Files\jfreechart1.0.13\lib\jfreechart1.0.13.jar" fileiotest.FileIOTestApp

Mike Keller
Posts: 23
Joined: Mon Jul 06, 2009 12:59 pm

Re: Trouble Compiling

Post by Mike Keller » Thu Dec 16, 2010 5:29 pm

Thank you, hopefully that will work. I will try it in a bit.

Also, to include the JFreeChart classes, do I need to do anything more than include the .jar files in the classpath? I think I must, but I'm not sure what.

Edit: I did just try recompiling. I got the same errors as I have been, which are like the following.

Code: Select all

fileiotest\FileIOTestView.java:1644: cannot find symbol
symbol  : class XYSeriesCollection
location: class fileiotest.FileIOTestView
    private XYSeriesCollection dataset6;
            ^
I mean, I obviously have to import XYSeriesCollection, but I have done that.

Code: Select all

import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Trouble Compiling

Post by skunk » Thu Dec 16, 2010 6:09 pm

Did you remove the space? Perhaps it would help to post the command you are running

Mike Keller
Posts: 23
Joined: Mon Jul 06, 2009 12:59 pm

Re: Trouble Compiling

Post by Mike Keller » Thu Dec 16, 2010 6:22 pm

Yes, I did remove the spaces. This is what my command-line looks like now:

Code: Select all

javac -classpath "C:\Program Files\java2\modules\ext\swing-worker-1.1.jar;C:\Program Files\java2\modules\ext\appframework-1.0.3.jar;C:\Program Files\jfreechart1.0.13\lib\jcommon-1.0.16.jar;C:\Program Files\jfreechart1.0.13\lib\jfreechart-1.0.13.jar" fileiotest\FileIOTestApp.java fileiotest\FileIOTestView.java fileiotest\FileIOTestAboutBox.java fileiotest\dllinterface.java

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Trouble Compiling

Post by skunk » Thu Dec 16, 2010 6:46 pm

Weird. I'm sure you have checked that the two jar files are located in a directory called

Code: Select all

C:\Program Files\jfreechart1.0.13\lib

Mike Keller
Posts: 23
Joined: Mon Jul 06, 2009 12:59 pm

Re: Trouble Compiling

Post by Mike Keller » Thu Dec 16, 2010 6:55 pm

Yes. I will double-check, though. Possibly I made a typo or otherwise have the path to the directory wrong.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: Trouble Compiling

Post by skunk » Thu Dec 16, 2010 8:33 pm

Another thought, if the classpath is wrong, I would expect the first compiler error to occur on this line

Code: Select all

import org.jfree.data.xy.XYSeriesCollection;
and not this one

Code: Select all

private XYSeriesCollection dataset6;
Are those import statements actually present in FileIOTestView.java?

Mike Keller
Posts: 23
Joined: Mon Jul 06, 2009 12:59 pm

Re: Trouble Compiling

Post by Mike Keller » Mon Dec 20, 2010 5:14 pm

I'm actually not sure where the first error occurs, there are enough that it fills up the command window beyond what it can even scroll up to. I could check by writing it to a log file, however, I just now solved the problem by running an elevated command window.

Locked