Board index » jbuilder » Re: Calling the constructor in the super class

Re: Calling the constructor in the super class


2005-02-18 08:57:44 AM
jbuilder8
Joe Vasher wrote:
Quote
When calling the constructor of a super class You simply "super(
commandName); ?

I get his warning:
cannot resolve symbol: constructor Command (java.lang.String)in class
com.specone.util.Command at line 25 (25:5)

There's no reason I can see for that to fail. Can you zip up sample
source and post it in the attachments group for one of us to take a
look at?
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
info.borland.com/newsgroups/guide.html
 
 

Re:Re: Calling the constructor in the super class

Joe Vasher wrote:
Quote
I put it up in attachements.
The Java code itself is fine, but your file structure is all over the
place. I strongly recommend that you read up on packages and the
associated directory structures. There's a decent tutorial here:
jarticles.com/package/package_eng.html
I would recommend a structure something like the following:
<project>
src
com
specone
client
server
Source in the client directory would be in package com.specone.client.
Similarly, source in the server directory would be in package
com.specone.server.
Once you have your files and packages sorted out, your code should
compile.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
info.borland.com/newsgroups/guide.html
 

Re:Re: Calling the constructor in the super class

When calling the constructor of a super class You simply "super(
commandName); ?
I get his warning:
cannot resolve symbol: constructor Command (java.lang.String)in class
com.specone.util.Command at line 25 (25:5)
public abstract class Command
{
private String commandName = null; // Hold command name
public String toUser = null; // for private messages
public String fromUser = null; // track who sent
public Object data = null; // this will store class or strings
// to be sent via socket.
public Command( String commandName )
{
this.commandName = commandName;
}
public abstract void execute();
}
class LoginCommand extends Command
{
LoginCommand( String commandName )
{
super( commandName );
}
public void execute()
{
System.out.println( "login" );
}
}
 

{smallsort}

Re:Re: Calling the constructor in the super class

Kevin Dean [TeamB] wrote:
Quote
Joe Vasher wrote:


>When calling the constructor of a super class You simply "super(
>commandName); ?
>
>I get his warning:
>cannot resolve symbol: constructor Command (java.lang.String)in class
>com.specone.util.Command at line 25 (25:5)
>


There's no reason I can see for that to fail. Can you zip up sample
source and post it in the attachments group for one of us to take a
look at?

I put it up in attachements.
 

Re:Re: Calling the constructor in the super class

Kevin Dean [TeamB] wrote:
Quote
Joe Vasher wrote:


>I put it up in attachements.


The Java code itself is fine, but your file structure is all over the
place. I strongly recommend that you read up on packages and the
associated directory structures. There's a decent tutorial here:

jarticles.com/package/package_eng.html

I would recommend a structure something like the following:

<project>
src
com
specone
client
server

Source in the client directory would be in package com.specone.client.
Similarly, source in the server directory would be in package
com.specone.server.

Once you have your files and packages sorted out, your code should
compile.

That is how I have mine setup, except for add util where client and
server are. I have had this problem before(where it started creating the
classes in my personal directory.) Do I have to setup the java sdk to
see this class path. XBUILDER won't handle this correctly.
I have added the library to my project using project properties.
Its still not using the correct one paths. XBUILDER (3500BUXs) should
beable to keep track of these paths, shouldn't it? Without me having to
figure out how to setup class paths in windows. I'm not manually
compiling(i'm using xbuilder.) one last note Command is part of another
project which I had setup to compile everything it was working fine with
those packages (Command) But I did have a point where I had to
manually compile with third party program (TextPad) then readd it to the
project in (XBUILDER) And it compiled and work fine after that. So I'm
really confused about where I have to change this.
I read that tutorial link and it looks like your telling me from that I
have to change the JVM guess this is where my confusion is coming from I
figured by adding the library to project it would find and work with
proper files.
 

Re:Re: Calling the constructor in the super class

Kevin Dean [TeamB] wrote:
Quote
Joe Vasher wrote:


>I put it up in attachements.


The Java code itself is fine, but your file structure is all over the
place. I strongly recommend that you read up on packages and the
associated directory structures. There's a decent tutorial here:

jarticles.com/package/package_eng.html

I would recommend a structure something like the following:

<project>
src
com
specone
client
server

Source in the client directory would be in package com.specone.client.
Similarly, source in the server directory would be in package
com.specone.server.

Once you have your files and packages sorted out, your code should
compile.

Well i figured it out. But I could have swore I had it set up correctly
the first time. Went into projects and changed the output path to
D:\java\ it now correctly puts command in the proper place. One last
thing, I added these files to the project shouldn't XBUILDER have know
where I added the files (Command.java) Guess it did. It just confused Or
I did where to build the class. Well I'll will go through all my classes
and make sure I have them set correctly.
Thanks.
 

Re:Re: Calling the constructor in the super class

Kevin Dean [TeamB] wrote:
Quote
Joe Vasher wrote:
Well {*word*99} super( CommandName ) giveing same error. I don't know whats
going on.
This class is in d:\java\com\specone\util\Command.class
its there its a fresh compile from XBUILDER
//Command
package com.specone.util;
import java.util.*;
public abstract class Command
{
private String commandName = null; // Hold command name
public String toUser = null; // for private messages
public String fromUser = null; // track who sent
public Object data = null; // this will store class or strings
// to be sent via socket.
public Command( String commandName )
{
this.commandName = commandName;
}
public abstract void execute();
}
This class is in d:\java\com\specone\server\classes\ServerCommandLoad.class
cannot resolve symbol: constructor Command (java.lang.String)in class
com.specone.util.Command at line 25 (25:5)
import com.specone.util.*;
public class ServerCommandLoad extends CommandLoader
{
ServerCommandLoad()
{
commandMap.put( "LOGIN", new LoginCommand( "LOGIN" ) );
commandMap.put( "LOGOFF", new Command()
{
public void execute()
{
System.out.println( "LOGOFF" );
}
} );
}
}
class LoginCommand extends Command
{
LoginCommand( String commandName )
{
super( commandName );
}
public void execute()
{
System.out.println( "login" );
}
}
 

Re:Re: Calling the constructor in the super class

Kevin Dean [TeamB] wrote:
Quote
Joe Vasher wrote:


>I put it up in attachements.


The Java code itself is fine, but your file structure is all over the
place. I strongly recommend that you read up on packages and the
associated directory structures. There's a decent tutorial here:

jarticles.com/package/package_eng.html

I would recommend a structure something like the following:

<project>
src
com
specone
client
server

Source in the client directory would be in package com.specone.client.
Similarly, source in the server directory would be in package
com.specone.server.

Once you have your files and packages sorted out, your code should
compile.

Well I got it to find all files. By adding these lines
import com.specone.util.Command;
import com.specone.util.CommandLoader;
This I thought would do the same.
import com.specone.util.*; But it doesn't.