how do you use cd(dir) to change the directory with java? I can't compile anything without it but I don't know how to change it!How do you change the directory with java?
At JDK compile time, you need to include a -classpath specifying where your directories and files are located at. Multiple directories and files are each separated by semicolon (;). If you're not using an IDE (e.g. Netbeans, Eclipse) and using a command line prompt, I recommend changing to the directory where your source code files are at and specifying (via shell script or .BAT file) the exact path to the java/bin directory. That way your classpath may simply be a single period/dot (.) to indicate your current directory containing the source code.
If you need to change directories at runtime, use the java.io.File methods or javax.swing.filechooser.FileSystemView as appropriate.
Subscribe to:
Post Comments
(Atom)
No comments:
Post a Comment