|
|
|
Re: Eclipse wont run my class [message #1059471 is a reply to message #1059463] |
Sun, 19 May 2013 10:23 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Roger,
Generally (at least when Auto Build is true), Eclipse compiles things as
soon as you save them, so generally the .class files are always up to
date with respect to the files in your workspace. More comments below.
On 19/05/2013 11:01 AM, Roger Wolfendale wrote:
> Ed, apologies for the delayed reply but many thanks, it worked fine.
> Just to clarify for any other newbies...
>
> 1. I right clicked the package that the 'Printer' class was contained
> in, 2. Selected Run As / Java Application,
> 3. Selected the 'Printer' class,
You could click directly on the Printer.java file...
> 4. From there the normal Run command worked as normal.
>
> I think item 3 re-compiled the class which still leaves me wondering
> what's going on as, quite separately, I had previously not only tested
> the class in NetBeans but also from the command line using javac
> Printer.java which created both the Printer.class and
> SubPrinter.class. From there invoking java SubPrinter ran the class
> successfully.
If there are multiple possible mains or the main isn't in the outermost
class, there's room for confusion; I think Eclipse will generally prompt
for such cases.
> Sorry to be a pest, Ed's suggestion worked fine and that should be
> enough but I don't exactly understand what Ed's suggestion achieved.
> Am I right in thinking that it basically compiled Printer.java and
> SubPrinter.java?
As I said above, that generally happens on save anyway. If you try to
run when there are unsaved changes, Eclipse generally asks if you want
to save such files and then it will compile them before trying to run
anything.
>
> Thanks again for your interest.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.09730 seconds