我是Java编程的新手,并且一直在使用Windows的大学计算机上工作。我是Mac用户,无法在终端中进行编译。这些是我遇到的错误:
Last login: Wed Feb 13 11:48:22 on ttys000
Sams-MacBook-Air:~ samsmac$ cd /Users/samsmac/Desktop/Week15
Sams-MacBook-Air:Week15 samsmac$ javac -cp json-simple-1.1.1.jar;. MessageBoardServerV4.java
javac: no source files
Usage: javac <options> <source files>
use -help for a list of possible options
-bash: //: is a directory
: command not found
-bash: //: is a directory
: No such file or directory.java
-bash: //: is a directory
-bash: port: No such file or directory
: command not found
-bash: import: command not found
: command not found
-bash: import: command not found
: command not found
-bash: import: command not found
-bash: //: is a directory
-bash: import: command not found
-bash: //: is a directory
: command not found
-bash: public: command not found
: command not found
-bash: static: command not found
-bash: private: command not found
: command not found
: command not found
-bash: MessageBoardServerV4.java: line 16: syntax error near unexpected token `('
'bash: MessageBoardServerV4.java: line 16: ` public Clock() { t = 0; }
它可以编译并在Windows上完美运行。任何帮助将不胜感激。
答案 0 :(得分:3)
在ix操作系统(如OSX ;
)上是命令分隔符。路径分隔符为:
。
因此更改为:
javac -cp json-simple-1.1.1.jar:. MessageBoardServerV4.java