Java error when compiling a plugin

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Java error when compiling a plugin

AJBell
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
Reply | Threaded
Open this post in threaded view
|

Re: Java error when compiling a plugin

Francesco De Comite
I also got this message.
Since this is just a warning, it seems to have no effect (at least for me).
But, if someone can tell me how to get rid of it...

     F. De Comité

Le 11/08/2013 09:18, AJBell a écrit :

> 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
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Java-error-when-compiling-a-plugin-tp5004378.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Java error when compiling a plugin

AJBell
Francesco De Comite wrote
I also got this message.
Since this is just a warning, it seems to have no effect (at least for me).
But, if someone can tell me how to get rid of it...

     F. De Comité
I would ignore it, however when running the code I am using (see first post), it throws an IOE Exception. I am of course presuming the two are related.

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: Java error when compiling a plugin

dscho
In reply to this post by AJBell
Hi Andrew,

On Sun, 11 Aug 2013, AJBell wrote:

> 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:
>
> [...]

It is in general a very bad idea to require new technologies unless you
have a very, very good reason to put that limitation on your software. In
the case of Java 1.7, it is even worse than just a violation of this
hard-earned insight: Java 1.7 is simply not available to users who have
MacOSX 10.6 or earlier (which is a ton of people).

It should not be a terribly big challenge for you to avoid relying on
too-new Java, in favor of opening your software for a larger potential
audience.

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

Yes, this is the hard-won insight I mentioned earlier, engrained into
ImageJ's "Compile and Run": even expert users are often not able to
overcome the obstacle imposed by requiring even Java 1.6 (e.g.
PowerPC-based Macs), while it does not challenge even only moderately
advanced developers to restrict their software to use the Java 1.5 API.

Having said that, in ImageJ2 and Fiji we actually do rely on Java 1.6 API
already... we use a component called Retrotranslator to allow the software
to run on Java 1.5 in many circumstances even if it was compiled for 1.6.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html