@@ -290,6 +290,12 @@ public void halt(int status) {
290
290
* behaves in exactly the same way as the invocation
291
291
* {@link #exec(String, String[], File) exec}{@code (command, null, null)}.
292
292
*
293
+ * @deprecated This method is error-prone and should not be used, the corresponding method
294
+ * {@link #exec(String[])} or {@link ProcessBuilder} should be used instead.
295
+ * The command string is broken into tokens using only whitespace characters.
296
+ * For an argument with an embedded space, such as a filename, this can cause problems
297
+ * as the token does not include the full filename.
298
+ *
293
299
* @param command a specified system command.
294
300
*
295
301
* @return A new {@link Process} object for managing the subprocess
@@ -311,6 +317,7 @@ public void halt(int status) {
311
317
* @see #exec(String[], String[], File)
312
318
* @see ProcessBuilder
313
319
*/
320
+ @ Deprecated (since ="18" )
314
321
public Process exec (String command ) throws IOException {
315
322
return exec (command , null , null );
316
323
}
@@ -324,6 +331,12 @@ public Process exec(String command) throws IOException {
324
331
* behaves in exactly the same way as the invocation
325
332
* {@link #exec(String, String[], File) exec}{@code (command, envp, null)}.
326
333
*
334
+ * @deprecated This method is error-prone and should not be used, the corresponding method
335
+ * {@link #exec(String[], String[])} or {@link ProcessBuilder} should be used instead.
336
+ * The command string is broken into tokens using only whitespace characters.
337
+ * For an argument with an embedded space, such as a filename, this can cause problems
338
+ * as the token does not include the full filename.
339
+ *
327
340
* @param command a specified system command.
328
341
*
329
342
* @param envp array of strings, each element of which
@@ -352,6 +365,7 @@ public Process exec(String command) throws IOException {
352
365
* @see #exec(String[], String[], File)
353
366
* @see ProcessBuilder
354
367
*/
368
+ @ Deprecated (since ="18" )
355
369
public Process exec (String command , String [] envp ) throws IOException {
356
370
return exec (command , envp , null );
357
371
}
@@ -374,6 +388,12 @@ public Process exec(String command, String[] envp) throws IOException {
374
388
* produced by the tokenizer are then placed in the new string
375
389
* array {@code cmdarray}, in the same order.
376
390
*
391
+ * @deprecated This method is error-prone and should not be used, the corresponding method
392
+ * {@link #exec(String[], String[], File)} or {@link ProcessBuilder} should be used instead.
393
+ * The command string is broken into tokens using only whitespace characters.
394
+ * For an argument with an embedded space, such as a filename, this can cause problems
395
+ * as the token does not include the full filename.
396
+ *
377
397
* @param command a specified system command.
378
398
*
379
399
* @param envp array of strings, each element of which
@@ -406,6 +426,7 @@ public Process exec(String command, String[] envp) throws IOException {
406
426
* @see ProcessBuilder
407
427
* @since 1.3
408
428
*/
429
+ @ Deprecated (since ="18" )
409
430
public Process exec (String command , String [] envp , File dir )
410
431
throws IOException {
411
432
if (command .isEmpty ())
0 commit comments