• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

runtime exec of command.com mkdir malfunction

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I get a command.com window and execute

it works perfectly. (I'm on an XP Home System)
But when I run a Java app to do the same thing via
runtime.exec() as in:


then the make directory command is limited to creating directories that have a maximum of 8 characters in their name.

Why is this? And how can I get the runtime.exec() process to execute a command.com mkdir internal command intrepeter command that creates directories with 9 or more characters?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And you can't use CMD.EXE because...? Or, for that matter, java.io.File.mkdir() ?
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ernest,

I tried cmd.exe and everything worked perfectly. Thanks very much for your input.
I'm going to be using cmd.exe for a long list of function invocations in the windows environment some of which don't nave a java equivalent (such as net stop and start for windows services), so I wanted to be consistent in my Java app.

However, I would appreciate further information as to what needs to be considered when choosing between command.com and cmd.exe. My information (which is obviously sketchy and flawed) was that cmd.exe should be used for NT and command.com for everything else (Windows 95, 98, XP, ME, etc.).
This is obviously incorrect and I would very much like to be set straight on this matter.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer your last question: you're correct except that you put XP in the wrong pile. If Windows 2000 was NT 5, then XP is "NT 6". 95/98/ME basically follow the old "shell on top of DOS" model, whereas the NT OSs are a complete OS in themselves.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
command /?

and

cmd /?

are pretty good. The big thing to notice is one is a "MS-DOS command interpreter" and the other is a "Windows NT command interpreter".
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
reply
    Bookmark Topic Watch Topic
  • New Topic