Используем книгу «Научимся программировать с плагинами Minecraft».
Пытаемся запустить build.sh через оболочку busybox для cmd.exe в Windows 10
Столкнулся с ошибкой ./build.sh: строка 46: jar: не найден
Мне интересно, чего мне не хватает, поскольку я точно следовал инструкциям , хотя, возможно, просто все кончилось дата.
#!/bin/sh
#---
# Excerpted from "Learn to Program with Minecraft Plugins, CanaryMod Edition",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/ahmine2 for more book information.
#---
# Set the variable MCSERVER to $HOME/Desktop/server,
# unless it's already set in the environment.
# To set it here explicitly, use MCSERVER=your_directory instead of
# this next line.
: ${MCSERVER:="$HOME/Desktop/server"}
MODS="$MCSERVER"/CanaryMod.jar
# Make sure that the library jar
# exists and is readable
if [ ! -e "$MODS" ]; then
echo "$MODS doesn't seem to exist. Make sure you have CanaryMod.jar installed at $MCSERVER and run again. If your server is not at $MCSERVER, set your MCSERVER environment variable to point to the correct directory."
exit 1
fi
# Make the build directories if they aren't there.
# Throw away any error if they are.
mkdir bin 2>/dev/null
mkdir dist 2>/dev/null
# Remove any previous build products
rm -f bin/*/*.class
rm -f dist/*.jar
# Get the name of this plugin
# from the directory it's in
HERE=`pwd`
NAME=`basename "$HERE"`
# 1. Compile
echo "Compiling with javac..."
javac -Xlint:deprecation src/*/*.java -d bin -classpath "$MODS" -sourcepath src -g:lines,vars,source || exit 2
# 2. Build the jar
echo "Creating jar file..."
jar -cf dist/"$NAME.jar" *.inf -C bin . || exit 3
# 3. Copy to server
echo "Deploying jar to $MCSERVER/plugins..."
test ! -d "$MCSERVER/plugins" && mkdir "$MCSERVER/plugins"
cp dist/$NAME.jar "$MCSERVER"/plugins || exit 4
echo "Completed Successfully."
редактировать: только что я попробовал другой метод тестирования команды jar, просто создав файл класса и попытавшись скомпилировать его в файл jar на рабочем столе.
jar -cvf MyJarFile.jar CreateAJarFile.class
У меня все еще та же проблема
sh: jar: не найден
редактировать:
Я использую оболочку для запуска команд с помощью busybox.exe, который я переименовал в sh.exe, и использую файл Shell.bat
C:\Windows\system32\cmd.exe /c sh.exe -l
Подробнее здесь: https://stackoverflow.com/questions/693 ... to-run-jar
Jar: не найден при попытке запустить jar ⇐ JAVA
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Maven генерирует фактический jar как файл .jar.original вместо файла .jar
Anonymous » » в форуме JAVA - 0 Ответы
- 62 Просмотры
-
Последнее сообщение Anonymous
-