I'm using IntelliJ for java development. I want to run my application on another host which I only have shell access to.
When I run my application locally, it's all fine and dandy. When I attempt to compile the code on the remote host, I get:
usr@host1:~/mp1/src$ javac -cp ../ Control.java
Control.java:10: error: cannot find symbol
private static Node genNode = null;
^
symbol: class Node
location: class Control
Control.java:25: error: cannot find symbol
genNode = new Node(hostname);
^
symbol: class Node
location: class Control
2 errors
The file Node.java
is in the same directory:
mp1
├── src
│ ├── ClientControl.java
│ ├── Control.java
│ ├── Node.java
│ ├── Registrar.java
│ ├── ServerControl.java
│ ├── UX.java
├── lib
│ └── kryonet-2.21-all.jar
I can't compile locally either, unless it's from within the IDE, so I assume I'm just not doing something right. What am I missing? I just want to be able to run my application from a shell, I don't really care how.
You have to correctly set the classpath when you compile.
There is a problem in your classpath. Since you have set only the parent directory as your classpath. You have to include src
too, since it contains your other source files.
Try:
javac -cp .:../lib/kryonet-2.21-all.jar Control.java