Skip to content

Commit 583cbc8

Browse files
authored
Fix compilation for unnamed packages
1 parent 847c494 commit 583cbc8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

CompileAndRunJava.applescript

+12-12
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,11 @@ end tell
5757
try
5858
tell application "Terminal"
5959
activate
60-
if (package_name is "") then
61-
#Define a simple javac command for single class programs without package declaration
62-
set shell_script to "cd " & quoted form of folder_path & ¬
63-
"; javac " & compiled_name & ".java"
64-
else
65-
#Define a more complex command for package structures:
66-
#Find all *.java files in the directory and compile them
67-
set shell_script to "cd " & quoted form of folder_path & ¬
68-
"; find . -name \"*.java\" -print | xargs javac "
69-
end if
60+
61+
#Define compilation targets by finding all java-files
62+
set shell_script to "cd " & quoted form of folder_path & ¬
63+
"; find . -name \"*.java\" -print | xargs javac "
64+
7065
#Execute the command in the terminal for the user
7166
if (count windows) is 0 then
7267
do script shell_script
@@ -86,8 +81,13 @@ if (no_error) then
8681
activate
8782

8883

89-
set shell_script to "cd " & quoted form of folder_path & ¬
90-
"; java " & package_name & "." & compiled_name
84+
if (package_name is "") then
85+
set shell_script to "cd " & quoted form of folder_path & ¬
86+
"; java " & compiled_name
87+
else
88+
set shell_script to "cd " & quoted form of folder_path & ¬
89+
"; java " & package_name & "." & compiled_name
90+
end if
9191

9292

9393
if (count windows) is 0 then

0 commit comments

Comments
 (0)