-bash:import:找不到命令:找不到命令Java Compilation Mac Terminal

问题描述 投票:1回答:1

我是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上编译并运行完美。任何帮助将非常感激。

java bash macos terminal compilation
1个回答
3
投票

在像OSX这样的操作系统上,;是命令分隔符。路径分隔符是:

所以改为:

javac -cp json-simple-1.1.1.jar:. MessageBoardServerV4.java
© www.soinside.com 2019 - 2024. All rights reserved.