| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu Feb 23, 2006 2:12 am Post subject: Problem Creating instances in Java |
|
|
Hi guys can anyone help im at my wits end with this.
i have many java programs on my computer that i have done in the past
and they all have worked fine. But!!! now i have a problem creating
instances of other classes for example:
Convert con = new Convert();
does not work. it says Cannot identify symbol Convert. But i know for a
fact the class Convert is compiled and also is in same directory.
Every time i try and compile a program it does not like any instance
methods.
(with all java files on my computer);
Many thanks
Andrew |
|
| Back to top |
|
 |
Hal Rosser Guest
|
Posted: Thu Feb 23, 2006 3:12 am Post subject: Re: Problem Creating instances in Java |
|
|
<carlito (AT) whitmore (DOT) fsnet.co.uk> wrote in message
news:1140658929.449640.32150 (AT) f14g2000cwb (DOT) googlegroups.com...
| Quote: | Hi guys can anyone help im at my wits end with this.
i have many java programs on my computer that i have done in the past
and they all have worked fine. But!!! now i have a problem creating
instances of other classes for example:
Convert con = new Convert();
does not work. it says Cannot identify symbol Convert. But i know for a
fact the class Convert is compiled and also is in same directory.
Every time i try and compile a program it does not like any instance
methods.
(with all java files on my computer);
|
If you create a Convert constructor which accepts an arg - and you did not
create a no-arg constructor, that error will occur. Java provides the
no-arg constructor free of charge, unless you create a constructor - in
which case the no-arg constructor is -not- provided. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Feb 23, 2006 4:12 am Post subject: Re: Problem Creating instances in Java |
|
|
actually my class Convert has a contructor with one argument. and i
call instance as follows
Convert con = new Convert(temp);
however when i compile from the command line it will not compile but if
i use a program such as netbeans or JCreate it compiles.
I dont understand why though
Cheers |
|
| Back to top |
|
 |
Roedy Green Guest
|
Posted: Thu Feb 23, 2006 6:12 am Post subject: Re: Problem Creating instances in Java |
|
|
On Wed, 22 Feb 2006 21:58:59 -0500, "Hal Rosser"
<hmrosser (AT) bellsouth (DOT) net> wrote, quoted or indirectly quoted someone
who said :
| Quote: | If you create a Convert constructor which accepts an arg - and you did not
create a no-arg constructor, that error will occur. Java provides the
no-arg constructor free of charge, unless you create a constructor - in
which case the no-arg constructor is -not- provided.
see http://mindprod.com/jgloss/gotchas.html#CONSTRUCTOR |
You might check out the other gotchas lying in wait for you while you
are there.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching. |
|
| Back to top |
|
 |
Roedy Green Guest
|
|
| Back to top |
|
 |
Roedy Green Guest
|
|
| Back to top |
|
 |
Guest
|
Posted: Thu Feb 23, 2006 7:12 pm Post subject: Re: Problem Creating instances in Java |
|
|
Thanks Guys everything really helped i have subsequently fixed the
problem.
The problem was that when setting my classpath i did not include
working directory as follows:
Classpath = C:\SomeFolder;C:\SomeOtherFolder\Some.jar; . ;
I needed to include the dot to include working dir
Cheers Again
Andrew |
|
| Back to top |
|
 |
|