Question

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?

Was it helpful?

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.

OTHER TIPS

His instructions are: "Burn .java file to CD, Compile the program, run the program. If I put your CD in my computer, and try to compile it, and get an error, you get a 0."

Those instructions don't say anything about compiling the Java file onto the CD. You're getting into a tangle about nothing. What you're asking about is impossible anyway. It it also isn't required.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top