Login  Register

Java error when compiling a plugin

Posted by AJBell on Aug 11, 2013; 7:18am
URL: http://imagej.273.s1.nabble.com/Java-error-when-compiling-a-plugin-tp5004378.html

Hi All,

I'm trying to use the Java 1.7 Files.copy to copy a set of images as part of a plugin using the following code:

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;
import java.nio.file.*;
import java.io.IOException;

public class Plugin_copy implements PlugIn {

        public void run(String arg) {
                try {
                Path source = Paths.get("C:\\My Documents\\Folder 1\\Testfile.txt");
                Path target = Paths.get("C:\\My Documents\\Folder 2\\Testfile.txt");
                Files.copy(source, target);
               
        } catch (InvalidPathException e) {
             IJ.log("Can't find files!");
            } catch (SecurityException e) {
              IJ.log("File access denied!");
            } catch (IOException e) {
              IJ.log("Error occured!");
            }
        }

}

But I am getting the following error: warning: [options] bootstrap class path not set in conjunction with -source 1.5

I gather that is related to the version of java (i.e. v1.5) but does anyone know how to fix it? I know I could just write this as a macro but it would still be good to be able to sort out this error message.

Andrew