aspose file tools*
The moose likes Java in General and the fly likes Giving up too soon.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Giving up too soon...." Watch "Giving up too soon...." New topic
Author

Giving up too soon....

Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
I'm up to my eyeballs with Java code! I code all day in Java at work and then come home and code some more. Perhaps this is why I don't see what's wrong with this?

Here's the error message:

e:\suncertify\server\DuplicateKeyException.java:3: error while writing suncertify.server.DuplicateKeyException: e:\suncertify\server\Contractor.java\suncertify\server\DuplicateKeyException.class (The system cannot find the path specified)

The Contractor.java does not even reference the DuplicateKeyException (double checked) anywhere in the code. Now they both reside in the same package if that matters. Here's the content of DuplicateKeyException which compiles:



Basically, my life resolves around Java right now (wish I was talking about Starbucks), so if you can spare a little compassion and forgive me if it's right under my nose, I would greatly appreciate it!

-Shannon
Rachel Swailes
Ranch Hand

Joined: May 18, 2004
Posts: 434
Can you post the code that is giving the error in Contractor.java?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
this has nothing to do with Java per se.

Something went wrong writing a file to disk. As a result another file that references that file cannot find it.
Maybe your Contractor class doesn't directly use your exception but is it used under water? Does some method call potentially throw your exception?

maybe your disk is full?


42
Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
Hi Rachel and Jeroen,
Thanks for your help.

Rachel,
Sure, I will post my Contractor code after work, don't have access to it right now.

Jeroen,
I'll have to double check, but I don't think any other methods are throwing the DuplicateKeyException to the Contractor. As of right now, the Contractor just holds information about itself (ie name, location, size....).

-Shannon
Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
Here's the code for the Contractor class:



There are other classes that throw the DuplicateKeyException but not to the Contractor class.

If something did go wrong writing the file to disk, is there a remedy for it?
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Is it a compile time error? Runtime error?
When does it occur?
C Kutler
Ranch Hand

Joined: Apr 15, 2004
Posts: 62
You do not say when this error message happens. Is it happening when you are compiling your code? That might explain why it is having trouble "writing". Are you compiling from the command line? Or maybe you are running the program from the IDE and the IDE automatically compiles dependent code (or depended upon code) that needs to be compiled whenever you run something.

So, can you explain what you are doing (and how) when you see this message?

The message "The system cannot find the path specified" seems to be an operating system message that the compiler (or runtime?) is passing thru. The other path it is looking for (e:\suncertify\server\Contractor.java\suncertify\server\DuplicateKeyException.class) seems very odd. It should be e:\suncertify\server\DuplicateKeyException.class. Maybe there is some problem with package name declarations???


We learn by doing, there is no other way.
Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
This error occurs during compile time. I'm using TextPad and Command Prompt to compile with. Only using Command Prompt to ensure TextPad is working as it should (trying the trial version 4.7.3). Both times, I get the same error...well until today, now I'm getting a different error message but as you can see, they are basically the same:

e:\suncertify\server\Controller.java:13: error while writing suncertify.server.Controller: e:\suncertify\server\Contractor.java\suncertify\server\Controller.class (The system cannot find the path specified)
public class Controller

this is the command I am using to compile all my classes:
-d e:\suncertify\server\*.java e:\suncertify\db\*.java

Here's the code for the Controller class:


Thank you everyone for helping!
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
After the -d option you need to specify the location where to place generated class files.

For example:
-d . e:\suncertify\server\*.java e:\suncertify\db\*.java

where "." means current directory. You can specify another directory location.

Sheldon Fernandes
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
I recommend that you automate your build process using ANT. It may take a little learning but will save you hours in the long run.
Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
Sheldon,
By adding the ".", this will resolve my issue? So why is it necessary, doesn't the compile know where the class files are?
Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
Wow, that worked! Thanks Sheldon!!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Giving up too soon....