Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java code not compiling with 'javac' but compiles in Eclipse

I have just written a Java multi-threaded program in Eclipse. It compiled fine and works like a charm.

However, as this is coursework we are required to ensure that it compiles in the command line using 'javac' otherwise we score ZERO!

So, some classes compile others don't. The error I'm getting is the following ( they are all similar just with different class names, this is one example)

GateRunnable.java:7: cannot find symbol
symbol  : class Station
location: class package.name.here.GateRunnable
    public GateRunnable(Station st) {
                        ^

Is this a javac issue? Any help appreciated.

like image 589
Force444 Avatar asked Feb 22 '26 08:02

Force444


1 Answers

Your compile -classpath and/or -sourcepath is incomplete. The compiler doesn't know where to find class Station. Here is a related question that describes how to set the classpath to include all the classes you want.

like image 196
mbatchkarov Avatar answered Feb 24 '26 21:02

mbatchkarov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!