AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem Creating instances in Java

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Feb 23, 2006 2:12 am    Post subject: Problem Creating instances in Java Reply with 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);

Many thanks

Andrew
Back to top
Hal Rosser
Guest





PostPosted: Thu Feb 23, 2006 3:12 am    Post subject: Re: Problem Creating instances in Java Reply with quote



<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






PostPosted: Thu Feb 23, 2006 4:12 am    Post subject: Re: Problem Creating instances in Java Reply with quote



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





PostPosted: Thu Feb 23, 2006 6:12 am    Post subject: Re: Problem Creating instances in Java Reply with quote

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





PostPosted: Thu Feb 23, 2006 6:12 am    Post subject: Re: Problem Creating instances in Java Reply with quote

On 22 Feb 2006 17:42:09 -0800, carlito (AT) whitmore (DOT) fsnet.co.uk wrote,
quoted or indirectly quoted someone who said :

Quote:
Convert con = new Convert();

You either screwed up your import or your classpath.

It is time to start putting all your code in a package. Package-less
stuff is just for experiments.


See http://mindprod.com/jgloss/classpath.html
http://mindprod.com/jgloss/import.html
http://mindprod.com/jgloss/package.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Back to top
Roedy Green
Guest





PostPosted: Thu Feb 23, 2006 3:12 pm    Post subject: Re: Problem Creating instances in Java Reply with quote

On 22 Feb 2006 20:07:56 -0800, carlito (AT) whitmore (DOT) fsnet.co.uk wrote,
quoted or indirectly quoted someone who said :

Quote:
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.

see http://mindprod.com/jgloss/gettingstarted.html
http://mindprod.com/jgloss/helloworld.html
http://mindprod.com/jgloss/classpath.html

there are dozens of ways to do it wrong.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Back to top
Guest






PostPosted: Thu Feb 23, 2006 7:12 pm    Post subject: Re: Problem Creating instances in Java Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.