atom-community / atom-script

:runner: Run ( scripts | selections | source ) in Atom
https://atom.io/packages/script
MIT License
734 stars 269 forks source link

Error running java when space in filename #2677

Open mathdeep opened 2 years ago

mathdeep commented 2 years ago

Hi everyone,

I can't run java files, which have a space in their filename. At first I want to say that this seems closely related to #1455 But because this is closed although I think no real solution was found, I hereby try it again. So when I want to run a java file with spaces in the file name, I get

error: invalid flag: C:\Users\Me\dir Usage: javac <options> <source files> use --help for a list of possible options

while the file is located in "C:\Users\Me\dir with spaces", so it ignores the " with spaces" and I think this is treaded as the arguments thereafter. There was #2428 marked, but this didn't solve it. I also tried the comment therein. I'm just guessing, but the problem seems to be before the argument formatting.

If anyone has ideas or if I should try something, let me know.

Best regards

icecream17 commented 2 years ago

Maybe try

https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html

[...] If a filename contains embedded spaces, put the whole filename in double quotes, and double each backslash ("My Files\\Stuff.java").

mathdeep commented 2 years ago

Hi icecream17,

Thanks for your reply. Yeah, that's what I'd like to do. My problem is that I don't know how to make script make this do. As I see it:

Any ideas? Somewhere I found, that you could try it with changing ''formatArgs'' in ''grammar-utils.js'' in the ''lib'' directory but this didn't really change anything. Otherwise I just tried the commands from there, so maybe I just didn't try the right one yet.