英文:
Java work on intelliJ but don't work in console terminal
问题
I tried to run my code on terminal, but when I try to do that, an error like this appears:
javac .\Server.java.\Server.java:27: error: cannot find symbol
ClientHandler clientHandler = new ClientHandler(socket);
^
symbol: class ClientHandler
location: class Server
.\Server.java:27: error: cannot find symbol
ClientHandler clientHandler = new ClientHandler(socket);
^
symbol: class ClientHandler
location: class Server
2 errors
I tried with java, javac, java -jar, java -cp, java -classpath command too.
All not work!
英文:
I tried to run my code on terminal, but when i try to do that appear an error like that:
javac .\Server.java.\Server.java:27: error: cannot find symbol
ClientHandler clientHandler = new ClientHandler(socket);
^
symbol: class ClientHandler
location: class Server
.\Server.java:27: error: cannot find symbol
ClientHandler clientHandler = new ClientHandler(socket);
^
symbol: class ClientHandler
location: class Server
2 errors
I tried with java, javac, java -jar, java -cp, java -classpath command too.
All not work!
答案1
得分: 0
看起来 ClientHandler
不是一个标准库类,它要么是由你编写的类,要么是某个库中的类。在第一种情况下,请不要忘记将所有源代码目录包含到 javac
命令行中,使用 -sourcepath
参数(更多信息可以参考这里)。在第二种情况下,请不要忘记将依赖库作为类路径通过 -cp
参数包含进去(更多信息可以参考这里)。
英文:
Looks like ClientHandler
is not an standard library class, it's either written by you class, either a class from some library. In the first case please don't forget to include all source directories to javac command line as -sourcepath
(more information for example here). In the second case don't forget to include dependency library as classpath via -cp
(more information for example here)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论