posted 20 years ago
First, there's no such method as System.exec(). The exec() methods are in the Runtime class.
You never need to import java.lang classes. If you get a compile-time error, it's never worth trying that. Note however that, if you use sub-packages of java.lang, such as java.lang.reflect, you would need to import those (but not in your example).
If your example, of running "cd", is what you really intend to do, then it won't work. If it ran at all, which it probably won't, it would only change the working directory of the spawned process, not the Java one. In fact, you can't change the working directory of a Java process (someone correct me if I'm wrong). There is, however, a version of exec() that allows you to specify a working directory for spawned processes.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.