Javac not found

Question:
How to fix the error Javac not found?

I followed a tutorial about how to make a (Miecraft) Spigot-Plugin
But when I pressed run it gave me the exitcode 127 (javac not found)
How could I fix that? Thanks in advance!

this tutorial is outdated, but I believe you can follow it if you ignore the rm * step. Also, where it asks you to create a .replit file: you already have a hidden .replit file, so whatever lines it asks you to add, just prepend to the existing file.
Alternatively, fork the example repl and work with that: Tutorial Plugin

2 Likes

You could also try running javac in the shell, and picking a version to install.

2 Likes

How do I run Javac in shell?

@UMARismyname Um, where would I need to add the lines in .replit
Here is the text from .replit:

compile = "javac -classpath .:target/dependency/* -d . $(find . -type f -name '*.java')"
run = "java -classpath .:target/dependency/* Main"
entrypoint = "src/main/java/Main.java"
hidden = ["**/*.class"]

[packager]
language = "java"

[packager.features]
packageSearch = true

[languages.java]
pattern = "**/*.java"

[languages.java.languageServer]
start = "jdt-language-server"

[unitTest]
language = "java"

[nix]
channel = "stable-22_11"

[debugger]
support = true

[debugger.compile]
command = "javac -classpath .:/run_dir/junit-4.12.jar:target/dependency/* -g -d . $(find . -type f -name '*.java')"

[debugger.interactive]
transport = "localhost:0"
connectTimeout = 60
startCommand = "java-debug"

[debugger.interactive.initializeMessage]
command = "initialize"
type = "request"

[debugger.interactive.initializeMessage.arguments]
adapterID = "cppdbg"
clientID = "replit"
clientName = "replit.com"
columnsStartAt1 = true
linesStartAt1 = true
locale = "en-us"
pathFormat = "path"
supportsInvalidatedEvent = true
supportsProgressReporting = true
supportsRunInTerminalRequest = true
supportsVariablePaging = true
supportsVariableType = true

[debugger.interactive.launchMessage]
command = "launch"
type = "request"

[debugger.interactive.launchMessage.arguments]
classPaths = ["."]
mainClass = "Main"

[deployment]
build = ["javac", "-classpath", ".:target/dependency/*", "-d", ".", "$(find . -type f -name '*.java')"]
run = ["java", "-classpath", ".:target/dependency/*", "Main"]
deploymentTarget = "cloudrun"

Since Umar said to

the lines, add them to the top of the file.

1 Like

Do I have to make a new repl (without th rm*)? Bc I added the lines to the .repl and presses run but it kept running/loading for 12minutes without finishing.

btw. I forked the tutorial project and it also didn’t work (33 - 34 error, exit code 1)

As the IDE should be warning you (if code intelligence is enabled), run is defined twice, so you’ll have to remove the existing run line. Set your .replit file to:

run="cd testplugin && mvn clean install"
compile = "javac -classpath .:target/dependency/* -d . $(find . -type f -name '*.java')"
entrypoint = "src/main/java/me.Babychaosfloh/testplugin/classes/test.java"
modules = ["java-graalvm22.3:v11-20240209-9e3a339"]

then try following the rest of the tutorial

2 Likes

Think Im gonna use Intellij there I know how it works

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.