File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes eclipse issue(s)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "eclipse issue(s)?" Watch "eclipse issue(s)?" New topic
Author

eclipse issue(s)?

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
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.


CNSS/NSA Infosec Professional,<br />Software Engineer
Sumit Deshpande
Ranch Hand

Joined: Jan 10, 2005
Posts: 38
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

Joined: Apr 18, 2002
Posts: 238
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

Joined: Apr 18, 2002
Posts: 238
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

Joined: Jul 08, 2003
Posts: 24166
    
  30

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 ]

[Jess in Action][AskingGoodQuestions]
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
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

Joined: Apr 18, 2002
Posts: 238
Gee, easy answer for this one.. make sure you close the connection, especially in Accesss.

Thanks for the responses....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: eclipse issue(s)?
 
Similar Threads
problem with mysql jdbc connection
Exception in thread "main"
JDBC Eclipse mySQL
UnsupportedClassVersionError (unsupported major.minor version 50.0)
NoClassDefFoundError in a simple program