My professor for my computer science course wants use to burn our .java to a CD, and be able to compile it on the CD. I tried doing this but when I compile I get a error saying it is a read-only file system. I am using a DVD+R. Here is the error:
Macintosh-2:Lab-09 Cody$ javac AsciiArt.java
AsciiArt.java:25: error: error while writing AsciiArt: AsciiArt.class (Read-only file system)
public class AsciiArt {
^
1 error
And yes, it does compile and run just fine when not on the CD. Is it possible to make the DVD+R writable so the code can be compiled on the CD? What about with a DVD-RW? How can this be done?
The javac
compiler reads *.java
source files and generates *.class
files. As I see it, since DVDs/CDs are write-once, you'll need to adopt one of the following approaches:
javac -d path/to/output/directory
to generate the compiled class files somewhere on their own computer, and running the program from there.