gpt4 book ai didi

java - 在 CentOS 5.6 上编译 java 时出现问题

转载 作者:行者123 更新时间:2023-12-02 00:41:58 26 4
gpt4 key购买 nike

对于 Windows,我只是使用批处理脚本来编译我的程序:

@echo off
title Building...
echo Building Server - please wait...
echo ---------------------------------------

set javac="C:\Program Files\java\jdk1.6.0_24\bin\javac.exe"

set libs=bin;

set dirs=src\server\*.java
set dirs=%dirs% src\server\commands\*.java
set dirs=%dirs% src\server\components\*.java
set dirs=%dirs% src\server\item\*.java
set dirs=%dirs% src\server\net\*.java
set dirs=%dirs% src\server\randomevent\*.java
set dirs=%dirs% src\server\minigames\*.java
set dirs=%dirs% src\server\minigames\trawler\*.java
set dirs=%dirs% src\server\minigames\trawler\game\*.java
set dirs=%dirs% src\server\quests\*.java
set dirs=%dirs% src\server\skills\runecrafting\*.java
set dirs=%dirs% src\server\skills\slayer\*.java
set dirs=%dirs% src\server\tasks\*.java
set dirs=%dirs% src\server\tasks\net\*.java
set dirs=%dirs% src\server\threading\*.java

%javac% -classpath %libs% %dirs% -d bin
echo ---------------------------------------
title Buld complete.
echo Build complete.
pause

一切都编译得很好。因此,我将项目移至 CentOS VPS 上并尝试使用 bash 脚本进行编译

echo Building...
echo Building Server - please wait...
echo ---------------------------------------

libs=bin
dirs=src/server/*.java
dirs=$dirs src/server/commands/*.java
dirs=$dirs src/server/components/*.java
dirs=$dirs src/server/item/*.java
dirs=$dirs src/server/net/*.java
dirs=$dirs src/server/randomevent/*.java
dirs=$dirs src/server/minigames/*.java
dirs=$dirs src/server/minigames/trawler/*.java
dirs=$dirs src/server/minigames/trawler/game/*.java
dirs=$dirs src/server/quests/*.java
dirs=$dirs src/server/skills/runecrafting/*.java
dirs=$dirs src/server/skills/slayer/*.java
dirs=$dirs src/server/tasks/*.java
dirs=$dirs src/server/tasks/net/*.java
dirs=$dirs src/server/threading/*.java

javac -classpath $libs $dirs -d bin
echo ---------------------------------------
title Buld complete.
echo Build complete.

我一定做错了什么。我收到这些错误:

: command not founde 4:
: No such file or directory/server/commands/*.java
: No such file or directory/server/components/*.java
: No such file or directory/server/item/*.java
: No such file or directoryc/server/net/*.java
: No such file or directoryc/server/randomevent/*.java
: No such file or directoryc/server/minigames/*.java
: No such file or directoryc/server/minigames/trawler/*.java
: No such file or directoryc/server/minigames/trawler/game/*.java
: No such file or directoryc/server/quests/*.java
: No such file or directoryc/server/skills/runecrafting/*.java
: No such file or directoryc/server/skills/slayer/*.java
: No such file or directoryc/server/tasks/*.java
: No such file or directoryc/server/tasks/net/*.java
: No such file or directoryc/server/threading/*.java
: command not founde 21:
javac: invalid flag: src/server/*.java

有人可以帮我弄清楚我做错了什么吗?是否有语法错误?

最佳答案

不知道为什么通配符没有被扩展,但是 dirs = 行不是有效的语法;您需要引用右侧。考虑到奇怪的错误消息,我怀疑是否使用 bash 来执行脚本。你确定是这样吗?

无论如何,哦。这是编译代码的疯狂方式。使用 Antmake,它们会让您的生活变得更加轻松。

关于java - 在 CentOS 5.6 上编译 java 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6102985/

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