1

I have created an application using the JFreeChart library for use on another machine.

Previously I have developed applications with JFreeChart (using the same libraries) which has worked fine on other machines. The only difference is this machine is running Vista.

Please see below for the run-time exception I am getting:

run-time-error

The class that cannot be found, however, is located in the highlighted jar in the below image showing my imported libraries for the JAR. I have also established that this JAR is included in the manifest for the application. See below image:

java-libraries-project

So I very much need this to work and have no idea where to look next - or what is causing this problem!

Development machine Java version: 1.7.0_45 Target machine Java version: 1.7.0_45

Thanks in advance.

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
cardycakes
  • 431
  • 1
  • 4
  • 12
  • how are you building executable jar? try put jfreechart jar in same directory as executable jar on target machine and see if that works.. – Sionnach733 Feb 27 '14 at 14:30
  • Thanks for your response (and the edit) Chris. I am building it via the 'Clean and Build Main Project' option in NetBeans. When I place the jar(s) in the same dir I get the same exception. Anything else I can do? – cardycakes Feb 27 '14 at 14:37

2 Answers2

1

Check the Class-Path attribute in your JAR's manifest, which should contain entries like this:

Class-Path: lib/jfreechart-1.0.17.jar lib/jcommon-1.0.21.jar …

Also, examine dist/README.TXT in your NetBeans project folder, which should say something like this regarding libraries required by your project:

To run the project from the command line, go to the dist folder and type the following:

java -jar "CISOnlineMonitor.jar" 

To distribute this project, zip up the dist folder (including the lib folder) and distribute the ZIP file.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • I had - stupidly - forgotten to copy over the lib folder along with my jar... Silly sod. But hopefully this question will help some other people who make the same silly mistake! Thanks for all the responses. Solved. – cardycakes Feb 28 '14 at 08:00
0

This has nothing to do with os i belive.You dont have all the necessery libs within your jar.Try to open a jar and see if you have them in.Fact that you are able to run it on your maschine only proves that.Make executable jar with eclipse or whathever you use.And when it ask you for libs check -Extract required libraries into generated Jar.

if you dont know how to get to that point

File>Export>Java>Runnable Jar File> Runnable JAR File Specification.

Also right click on your project and check Your build path.

RightClick project>Properties>Java Build Path>Libraries

Make sure you have everything correct

EDIT-

As i see you use NetBeans im not sure exactly how to find all this there.Bud it will be very similiar.

Tomas Bisciak
  • 2,801
  • 5
  • 33
  • 57