Java cmd窗口无法识别classpath选项

Java cmd窗口无法识别classpath选项,java,classpath,Java,Classpath,当我进来的时候 java -classpath .;mariadb-java-client-2.7.1.jar MusicMain 错误是这样发生的 Usage: java [options] <mainclass> [args...] (to execute a class) or java [options] -jar <jarfile> [args...] (to execute a jar file) o

当我进来的时候

java -classpath .;mariadb-java-client-2.7.1.jar MusicMain
错误是这样发生的

Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)
   or  java [options] <sourcefile> [args]
           (to execute a single source-file program)

 Arguments following the main class, source file, -jar <jarfile>,
 -m or --module <module>/<mainclass> are passed as the arguments to
 main class.

 where options include:

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    --class-path <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -p <module path>
    --module-path <module path>...
                  A : separated list of directories, each directory
                  is a directory of modules.
    --upgrade-module-path <module path>...
                  A : separated list of directories, each directory
                  is a directory of modules that replace upgradeable
                  modules in the runtime image
    --add-modules <module name>[,<module name>...]
                  root modules to resolve in addition to the initial module.
                  <module name> can also be ALL-DEFAULT, ALL-SYSTEM,
                  ALL-MODULE-PATH.
    --list-modules
                  list observable modules and exit
    -d <module name>
    --describe-module <module name>
                  describe a module and exit
    --dry-run     create VM and load main class but do not execute main method.
                  The --dry-run option may be useful for validating the
                  command-line options such as the module system configuration.
    --validate-modules
                  validate all modules and exit
                  The --validate-modules option may be useful for finding
                  conflicts and other errors with modules on the module path.
    -D<name>=<value>
                  set a system property
    -verbose:[class|module|gc|jni]
                  enable verbose output for the given subsystem
    -version      print product version to the error stream and exit
    --version     print product version to the output stream and exit
    -showversion  print product version to the error stream and continue
    --show-version
                  print product version to the output stream and continue
    --show-module-resolution
                  show module resolution output during startup
    -? -h -help
                  print this help message to the error stream
    --help        print this help message to the output stream
    -X            print help on extra options to the error stream
    --help-extra  print help on extra options to the output stream
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:jdwp
                  see also -agentlib:jdwp=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
                  HiDPI scaled images are automatically supported and used
                  if available. The unscaled image filename, e.g. image.ext,
                  should always be passed as the argument to the -splash option.
                  The most appropriate scaled image provided will be picked up
                  automatically.
                  See the SplashScreen API documentation for more information
    @argument files
                  one or more argument files containing options
    -disable-@files
                  prevent further argument file expansion
    --enable-preview
                  allow classes to depend on preview features of this release
To specify an argument for a long option, you can use --<name>=<value> or
--<name> <value>.

zsh: command not found: mariadb-java-client-2.7.1.jar
用法:java[options][args…] (执行一个类) 或java[options]-jar[args…] (执行jar文件) 或java[options]-m[/][args…] java[选项]--模块[/][args…] (在模块中执行主类) 或java[options][args] (执行单个源文件程序) 主类、源文件、-jar、, -m或--module/作为参数传递给 主课。 其中包括: -cp -类路径 --类路径 A:目录、JAR档案的单独列表, 和压缩档案以搜索类文件。 -p --模块路径。。。 A:单独的目录列表,每个目录 是一个模块目录。 --升级模块路径。。。 A:单独的目录列表,每个目录 是替换可升级模块的模块目录 运行时映像中的模块 --添加模块[,…] 除了初始模块之外,还要解析根模块。 也可以是全默认、全系统、, 全模块路径。 --列出模块 列出可观察到的模块并退出 -d --描述模块 描述一个模块并退出 --干运行创建VM并加载主类,但不执行main方法。 --dry run选项可能有助于验证 命令行选项,如模块系统配置。 --验证模块 验证所有模块并退出 --validate modules选项对于查找 与模块路径上的模块发生冲突和其他错误。 -D= 设置系统属性 -详细:[类|模块| gc | jni] 为给定子系统启用详细输出 -版本将产品版本打印到错误流并退出 --版本将产品版本打印到输出流并退出 -showversion将产品版本打印到错误流并继续 --显示版本 将产品版本打印到输出流并继续 --显示模块分辨率 启动期间显示模块分辨率输出 -? -h-帮助 将此帮助消息打印到错误流 --帮助将此帮助消息打印到输出流 -X打印有关错误流附加选项的帮助 --帮助额外打印关于输出流额外选项的帮助 -ea[:…|:] -启用评估[:…|:] 启用具有指定粒度的断言 -da[:…;:] -取消分配[:…|:] 禁用具有指定粒度的断言 -esa |-启用系统断言 启用系统断言 -dsa |-禁用系统断言 禁用系统断言 -agentlib:[=] 加载本机代理库,例如-agentlib:jdwp 另请参见-agentlib:jdwp=help -代理路径:[=] 按完整路径名加载本机代理库 -javaagent:[=] 加载Java编程语言代理,请参阅Java.lang.instrument -飞溅: 用指定的图像显示启动屏幕 自动支持并使用HiDPI缩放图像 如果有的话。未缩放的图像文件名,例如image.ext, 应该始终作为参数传递给-splash选项。 将拾取提供的最合适的缩放图像 自动地 有关更多信息,请参阅SplashScreen API文档 @参数文件 一个或多个包含选项的参数文件 -禁用-@文件 防止进一步的参数文件扩展 --启用预览 允许类依赖于此版本的预览功能 要为长选项指定参数,可以使用--=或 -- . zsh:未找到命令:mariadb-java-client-2.7.1.jar
有什么问题吗?

根据错误,您似乎正在使用Linux/Unix系统:
zsh:command not found:mariadb-java-client-2.7.1.jar

因此,Java命令需要使用冒号
,而不是分号

分号是Windows上用于
java
命令的JAR分隔符。但是对于Linux,它是冒号(您可以在用法消息中看到:
A:目录的分离列表,JAR存档…

因此,请尝试以下方法:

java -classpath .:mariadb-java-client-2.7.1.jar MusicMain
在您的例子中,分号被解释为命令分隔符,因此是
之后的下一个“命令”
被假定为
mariadb-java-client-2.7.1.jar
——这就是为什么会出现特定的“command not found”错误