+ 2
I want to pass 2 args in the cmd but one of the arguments has a space in them so it is taken as 3 arguments? What must i do?
I have a java program that takes two command line arguments. The program copies the contents of the first file into the second file.The arguments must be the paths of two files but one path has a space in it so cmd takes it as 3 args. I tried using double quotes but it does not help. Please tell me what to do. P.S. I am using Windows.
6 Respuestas
+ 4
Use the Scanner nextLine() method.
My idea is to tell the user to separate paths by ','. So you could store the paths in an array using split(",") method.
+ 3
Seniru Pasan thanks for the idea I will try that.
0
Use an underscore as there should be no gaps in arguments like this, one_argument.
0
It's weird cause usually single quote or double quote should solve the problem.
0
Use an underscore instead of a space,space is usually called a whitespace character in java
0
Codebeast** it says that it can't find the file when I use an underscore where the space supposed to be