gpt4 book ai didi

java - 类路径在 linux 下不起作用

转载 作者:IT老高 更新时间:2023-10-28 12:32:06 26 4
gpt4 key购买 nike

任何人都知道为什么这个命令在 Windows 中运行良好,但在 Linux 中我得到一个 ClassNotFoundException game.ui.Main

java -cp ".;lib/*" game.ui.Main -Xms64m -Xmx128m

我的文件夹结构如下所示:lib/- jar 游戏/- 类文件

这是最新的 Java 6。

最佳答案

类路径语法取决于操作系统。来自 Wikipedia :

Being closely associated with the file system, the command-line Classpath syntax depends on the operating system. For example:

on all Unix-like operating systems (such as Linux and Mac OS X), the directory structure has a Unix syntax, with separate file paths separated by a colon (":").

on Windows, the directory structure has a Windows syntax, and each file path must be separated by a semicolon (";").

This does not apply when the Classpath is defined in manifest files, where each file path must be separated by a space (" "), regardless of the operating system.

关于java - 类路径在 linux 下不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4528438/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com