(newbie) compiling problem

G

Gary

OK, I decided to try RMI, but I'm getting stuck on compiling. I've
relied so long on Forrte and Eclipse that I can't remember how to
compile.

I have two classes: Foo, and Bar. Bar extends Foo. The point is that I
have one class that needs the other to compile.

I've tried Textpad and the command line, and neither works, although I
have no problem when I do it from Eclipse.

I've put the in the dedfault package and trry this:
javac Foo.java
javac Bar.java

Foo compiles OK, but when I go to compile Bar, I get this message:
---------------------------------
C:\eclipse\workspace\MyTest\Bar.java:2: cannot resolve symbol
symbol : class Foo
location: class Bar
public class Bar extends Foo {}
^
1 error

Tool completed with exit code 1
---------------------------------

I've also triedd putting them in a package together. Nothing works.
I'm sure this is something simple. I know I've done this a million
times, but I can't remember what I did different.

Thanks for the help, and let this be a warning to any of you who think
an IDE is going to solve all your problems.
 
T

Thomas Thrien

OK, I decided to try RMI, but I'm getting stuck on compiling. I've
relied so long on Forrte and Eclipse that I can't remember how to
compile.

I have two classes: Foo, and Bar. Bar extends Foo. The point is that I
have one class that needs the other to compile.

I've tried Textpad and the command line, and neither works, although I
have no problem when I do it from Eclipse.

I've put the in the dedfault package and trry this:
javac Foo.java
javac Bar.java

Foo compiles OK, but when I go to compile Bar, I get this message:
---------------------------------
C:\eclipse\workspace\MyTest\Bar.java:2: cannot resolve symbol
symbol : class Foo
location: class Bar
public class Bar extends Foo {}
^
1 error

Tool completed with exit code 1
---------------------------------

I've also triedd putting them in a package together. Nothing works.
I'm sure this is something simple. I know I've done this a million
times, but I can't remember what I did different.

Thanks for the help, and let this be a warning to any of you who think
an IDE is going to solve all your problems.


Assuming the following source:

File Foo.java:
package a;

class Foo
{...}
-----
File Bar.java:
package a;

class Bar extends Foo
{...}
-----
Afterwards Bar.java and Foo.java have to be in a subdir named a.
Preferably you should run javac as

javac -da a/Bar

now from the dir below a. This would compile both files (it does it
for me).

Other option: remove the package statements and start the javac from
the same dir the *.java file are in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top