javacompiler-errorsdvd

Allow java program that is on a DVD+R to be compiled ON that DVD+R


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?


Solution

  • 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:

    1. You compile the Java and burn both the source and class files onto the disk.
    2. You put the Java source onto the disk, and then your lecturer uses something like javac -d path/to/output/directory to generate the compiled class files somewhere on their own computer, and running the program from there.