Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Giving up too soon....

 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the code that is giving the error in Contractor.java?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it a compile time error? Runtime error?
When does it occur?
 
C Kutler
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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???
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 703
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, that worked! Thanks Sheldon!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic