简体   繁体   English

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

[英]-bash: import: command not found : command not found Java Compilation Mac Terminal

I am new to programming in Java and have been working on university computers with Windows. 我是Java编程新手,一直在使用Windows的大学计算机。 I am a Mac user and having trouble trying to compile in terminal. 我是Mac用户,无法尝试在终端中编译。 These are the errors I am presented with: 这些是我提出的错误:

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; }

This compiles and runs perfectly fine on Windows. 这在Windows上编译并运行完美。 Any help would be much appreciated. 任何帮助将非常感激。

On ix operating systems like OSX ; 在像OSX这样的ix操作系统上; is the command separator. 是命令分隔符。 Path separator is : . 路径分隔符是:

So change to: 所以改为:

javac -cp json-simple-1.1.1.jar:. MessageBoardServerV4.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM