Details
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8268979 | 18 | William Harnois | P3 | Closed | Fixed | b03 |
JDK-8270774 | 17.0.1 | William Harnois | P3 | Closed | Fixed | b03 |
JDK-8269101 | 11.0.13-oracle | William Harnois | P3 | Closed | Fixed | b01 |
Description
A DESCRIPTION OF THE PROBLEM :
When installing Java 16.0.1 at least two java.exe files are installed. On my machine:
1. C:\Program Files\Java\jdk-16.0.1\bin\java.exe
2. C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
And #2 is the one linked to the `java` command on the system.
These two java.exe behave differently with respect to double quoted command line arguments.
#1 Keeps the double quotes
#2 Strips the double quotes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Here's a reproduction:
public class PrintArgs {
public static void main(String [] args) {
for (String arg: args) {
System.out.println(arg);
}
}
}
Running this using the installed java (which uses #2 above):
PS C:\Program Files\Java\jdk-16.0.1\bin> java PrintArgs '\"bar\"'
bar
Running it using #1:
PS C:\Program Files\Java\jdk-16.0.1\bin> .\java.exe PrintArgs '\"bar\"'
"bar"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should print "bar" (with the double quotes intact).
ACTUAL -
Prints bar (double quotes stripped).
---------- BEGIN SOURCE ----------
public class PrintArgs {
public static void main(String [] args) {
for (String arg: args) {
System.out.println(arg);
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I have found no workaround what so ever. I'd be super happy to know of one.
FREQUENCY : always
When installing Java 16.0.1 at least two java.exe files are installed. On my machine:
1. C:\Program Files\Java\jdk-16.0.1\bin\java.exe
2. C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
And #2 is the one linked to the `java` command on the system.
These two java.exe behave differently with respect to double quoted command line arguments.
#1 Keeps the double quotes
#2 Strips the double quotes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Here's a reproduction:
public class PrintArgs {
public static void main(String [] args) {
for (String arg: args) {
System.out.println(arg);
}
}
}
Running this using the installed java (which uses #2 above):
PS C:\Program Files\Java\jdk-16.0.1\bin> java PrintArgs '\"bar\"'
bar
Running it using #1:
PS C:\Program Files\Java\jdk-16.0.1\bin> .\java.exe PrintArgs '\"bar\"'
"bar"
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should print "bar" (with the double quotes intact).
ACTUAL -
Prints bar (double quotes stripped).
---------- BEGIN SOURCE ----------
public class PrintArgs {
public static void main(String [] args) {
for (String arg: args) {
System.out.println(arg);
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
I have found no workaround what so ever. I'd be super happy to know of one.
FREQUENCY : always
Attachments
Issue Links
- backported by
-
JDK-8268979 javapath/java.exe strips double quotes from command line args
- Closed
-
JDK-8269101 javapath/java.exe strips double quotes from command line args
- Closed
-
JDK-8270774 javapath/java.exe strips double quotes from command line args
- Closed
- relates to
-
JDK-8296383 javapath/java.exe strips embedded double quotes from command line arguments
- Closed