Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

eclipse issue(s)?

 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code that executes through eclipse, well, ok I guess. I do have some issues, however.

First issue is that when I try to execute the file from the console I get the following message:



The other issue is that the sql update only works when I step the code through the debugger. This is a problem, and I am wondering if it is a known eclipse issue or somthing else.

The code is:


My version of Eclipse is

Version: 3.1.0
Build id: 200408122000

Thanks.
 
Sumit Deshpande
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sam Smoot:
I have the following code that executes through eclipse, well, ok I guess. I do have some issues, however.

First issue is that when I try to execute the file from the console I get the following message:



To me this sounds like a classpath problem. Is the AddID.class file present in your classpath ? May be, i'm not sure about this, but have you changed the case of the folder's name (from oldIDs to oldIds - note the change in case for 'd') ?


The other issue is that the sql update only works when I step the code through the debugger. This is a problem, and I am wondering if it is a known eclipse issue or somthing else.

What happens when you run the program from eclipse as run- java application. Does it throw any error ?

Regards,
Sumit.
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AddID is this class.

Inside the IDE it works fine. THe update only works when I step through the debugger, though.

I have a simpler example in the JAVA Beginer's forum just because I thought it was somthing I've overlooked, but this isn't the only code that this is happening to. It only works in IDE's, but not natively.

http://www.coderanch.com/t/399656/java/java/Why-oh-why-do-even


[ May 13, 2005: Message edited by: Sam Smoot ]
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, Package information has to go.... I removed the package declaration, and the code works external to the Eclipse environment. HOWEVER, Eclipse insists that it has to be there or it won't compile the code.

HELP! :roll:
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The name of the package that a class is in is part of the class's name. You cannot run a class from the command line and leave off the package name under any circumstances, because you'll not be calling the class by its proper name. That means, in this case, that the only proper way to invoke the class "oldIds.AddID" is with

java oldIds.AddID

The alternative,

java AddID

is incorrect and cannot be made to work.

Now, there's one more detail: when you invoke this class, Java will look at the classpath to find the oldIds package (i.e., a directory named oldIds) and then in that package, it will look for AddID.class . Therefore, the oldIds directory is the thing that must be on the CLASSPATH, and not the AddID.class file. So, for example, one scenario that works: Say you've got c:\JavaCode\oldIds\AddID.class . Then you could type something along the lines of

X:\> c:
C:\> cd \JavaCode
C:\JavaCode> java -cp . oldIds.AddID

and, like magic, it will work!

If the C:\JavaCode directory appears on your CLASSPATH environment variable, then

java oldIds.AddID

will work from any arbitrary directory. See here for more information on this topic.

Good luck!
[ May 15, 2005: Message edited by: Ernest Friedman-Hill ]
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I went with the default package idea for an "easy out" so I can get the project out the door, but having this information will help on the second round.

Now all I need to do is to figure out why it only updates my database when the program steps through the debugger (from ANY IDE) and not when you run it as is.

I never get the simple problems.....
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gee, easy answer for this one.. make sure you close the connection, especially in Accesss.

Thanks for the responses....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic