• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

CGT tax calculations: errors when reusing old code

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Java once a year to calculate CGT for my tax return. It is run from the command line, and a bit idiosychratic, but it is just for me. The general procedure is described here.

It worked for years but it is now playing up, possibly since I started using Windows 10, or maybe Java or Derby has changed.  

Anyway this year the command:
yields the error: Could not find or load main class

But if I fiddle with the command:
the class is found and runs and I get a connection error: SQLException: org.apache.derby.jdbc.EmbeddedDriver

I'm running out of time, so I'll post the source code for the class in the hope that someone can spot the error.

 
Marshal
Posts: 25669
69
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Mike!

The proximate error (the one which makes it hard to see the actual error) is that you don't print a lot of the useful data which the exception includes. Try this instead:



 
Mike Carter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that Paul, and for your welcome.

I took your advice and modified my error code, and this is what it generated:
So it's another class not found exception, but the derby.jar file is in the same folder as everything else. I think there may be something wrong with the way I am setting out the list of class paths, but I can't see what it is. If you or anyone else can, I'd be grateful.

 
Rancher
Posts: 4603
47
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The derby jar file doesn't have a '.' at the start of it, unless you've renamed it.
 
Mike Carter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave, I've always struggled with paths.

Anyway, that fixed it
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic