Прошу помочь разобраться, напишу всю информацию.
Все файлы проекта
$ find .
./.gradle
./.gradle/buildOutputCleanup
./.gradle/buildOutputCleanup/outputFiles.bin
./.gradle/buildOutputCleanup/cache.properties
./.gradle/buildOutputCleanup/buildOutputCleanup.lock
./.gradle/7.4.2
./.gradle/7.4.2/vcsMetadata
./.gradle/7.4.2/fileHashes
./.gradle/7.4.2/fileHashes/fileHashes.lock
./.gradle/7.4.2/fileHashes/resourceHashesCache.bin
./.gradle/7.4.2/fileHashes/fileHashes.bin
./.gradle/7.4.2/dependencies-accessors
./.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock
./.gradle/7.4.2/dependencies-accessors/gc.properties
./.gradle/7.4.2/fileChanges
./.gradle/7.4.2/fileChanges/last-build.bin
./.gradle/7.4.2/checksums
./.gradle/7.4.2/checksums/sha1-checksums.bin
./.gradle/7.4.2/checksums/md5-checksums.bin
./.gradle/7.4.2/checksums/checksums.lock
./.gradle/7.4.2/gc.properties
./.gradle/7.4.2/executionHistory
./.gradle/7.4.2/executionHistory/executionHistory.bin
./.gradle/7.4.2/executionHistory/executionHistory.lock
./.gradle/file-system.probe
./.gradle/vcs-1
./.gradle/vcs-1/gc.properties
./compilerun.sh
./run.sh
./src
./src/main
./src/main/java
./src/main/java/sources
./src/main/java/sources/Testclass.java
./build
./build/classes
./build/classes/java
./build/classes/java/main
./build/classes/java/main/dev
./build/classes/java/main/dev/selenium
./build/classes/java/main/dev/selenium/hello
./build/classes/java/main/dev/selenium/hello/Testclass.class
./build/libs
./build/libs/parsing_selenium.jar
./build/libs/libs
./build/tmp
./build/tmp/compileJava
./build/tmp/compileJava/previous-compilation-data.bin
./build/tmp/jar
./build/tmp/jar/MANIFEST.MF
./build/scripts
./build/scripts/parsing_selenium
./build/scripts/parsing_selenium.bat
./build/generated
./build/generated/sources
./build/generated/sources/annotationProcessor
./build/generated/sources/annotationProcessor/java
./build/generated/sources/annotationProcessor/java/main
./build/generated/sources/headers
./build/generated/sources/headers/java
./build/generated/sources/headers/java/main
./build/distributions
./build/distributions/parsing_selenium.tar
./build/distributions/parsing_selenium.zip
./backup.build.grandle
./build.gradle
Компиляция успешна
Неудачная попытка запуска .jar программы$ java -jar build/libs/parsing_selenium.jar
Error: Could not find or load main class Testclass
Caused by: java.lang.ClassNotFoundException: Testclass
Testclass.java
package dev.selenium.hello;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
public class Testclass {
public static void main(String[] args) {
FirefoxOptions options = new FirefoxOptions();
FirefoxDriver driver = new FirefoxDriver(options);
driver.quit();
}
}
build.gradleapply plugin: 'java'
apply plugin: "application"
mainClassName = "Testclass"
jar {
manifest.attributes("Main-Class": mainClassName);
}
repositories {
mavenLocal()
mavenCentral()
}
// https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
dependencies {
implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.1.4'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-api', version: '4.1.4'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-remote-driver', version: '4.1.4'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-support', version: '4.1.4'
implementation group: 'org.seleniumhq.selenium', name: 'selenium-firefox-driver', version: '4.1.4'
}
На всякий случай
echo $PATH:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/bin/gradle-7.4.2/bin:/usr/bin/firefox
Другие переменные среды я не менял.
P.S. run.sh и
compilerun.sh просто запускают и компилируют проект, что бы не прописывать некороткий путь к .jar файлу.
P.P.S. каталог
/build/classes/java/main/dev/selenium/hello
от прошлого скрипта, не используется.
UPD:
Неудачный запуск скрипта$ java -jar build/libs/parsing_selenium.jar
Error: Could not find or load main class Testclass
Caused by: java.lang.ClassNotFoundException: Testclass