Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > (newbie) compiling problem

Reply
Thread Tools

(newbie) compiling problem

 
 
Gary
Guest
Posts: n/a
 
      08-30-2003
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.
 
Reply With Quote
 
 
 
 
D Goldman
Guest
Posts: n/a
 
      08-31-2003
> you propably don't have foo.class in your classpath.
>
> do something like that in your console:
>
> javac -classpath Path/To/Foo Bar.java



If both Foo and Bar are in the same directory, then you can just do the following:
javac -classpath . Bar.java

Make sure you incluse the ".", since it points to the current directory.


<a href="http://d-goldman.org">Posted by: </a>
<a href="http://www.geocities.com/danielgoldman2/index.html>Daniel Goldman</a>
 
Reply With Quote
 
 
 
 
Thomas Thrien
Guest
Posts: n/a
 
      09-01-2003
On 30 Aug 2003 08:56:50 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (Gary) wrote:

>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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Cross-compiling error when compiling 2.6.1... Garrett Cooper Python 0 02-24-2009 09:47 PM
Cross-compiling error when compiling 2.6.1... Garrett Cooper Python 0 02-24-2009 08:55 PM
Compiling when libedit is in path Is there a trick to compiling Ruby when libedit must exist in the search path? Can you statically link to readline 5.0 in some manner? -- Lon Baker Lon Baker Ruby 1 03-21-2005 08:57 AM
Problem compiling ASP.NET application David Berman ASP .Net 2 01-28-2004 02:59 PM
problem compiling perl source on AIX 5.1.0.0 using GCC marko sarunac Perl 0 11-17-2003 07:21 PM



Advertisments