From 7f11f72463e42ea8ddbc1fce07c805803458e8ac Mon Sep 17 00:00:00 2001 From: Ned Palacios Date: Mon, 5 Feb 2024 02:07:24 +0800 Subject: [PATCH] fix: java run command --- server/helpers/runner.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/helpers/runner.go b/server/helpers/runner.go index b16a1bd..9b8c8a9 100644 --- a/server/helpers/runner.go +++ b/server/helpers/runner.go @@ -19,7 +19,7 @@ var defaultRunCommands = map[string]RunCommand{ "python": {Universal: "python3 ${file}"}, "c": {Universal: "gcc ${file} -o ${fileNoExt} && ./${fileNoExt}"}, "cpp": {Universal: "g++ ${file} -o ${fileNoExt} && ./${fileNoExt}"}, - "java": {Universal: "javac ${file} && java ${fileNoExt}"}, + "java": {Universal: "javac ${filename} && java ${filenameNoExt}"}, "rust": {Universal: "rustc ${file} && ./${fileNoExt}"}, "go": {Universal: "go run ${file}"}, "js": {Universal: "node ${file}"}, @@ -125,6 +125,7 @@ func GetRunCommand(languageId string, filePath string) (string, error) { r := strings.NewReplacer( "${file}", filePath, "${filename}", filepath.Base(filePath), + "${filenameNoExt}", strings.TrimSuffix(filepath.Base(filePath), filepath.Ext(filePath)), "${dir}", filepath.Dir(filePath), "${fileNoExt}", strings.TrimSuffix(filePath, filepath.Ext(filePath)), )