Login  Register

Re: compiling problems Java 8 and string manipulation

Posted by Rasband, Wayne (NIH/NIMH) [E] on Sep 08, 2015; 2:27pm
URL: http://imagej.273.s1.nabble.com/compiling-problems-Java-8-and-string-manipulation-tp5014260p5014266.html

> On Sep 7, 2015, at 2:39 PM, Joe Vandergracht <[hidden email]> wrote:
>
> Hello,
>
> I have been compiling plugins on a Mac running 10.6.8 with Java 1.6.0_65 from Apple.  I just bought a 10.10.4 Mac and installed the experimental version ImageJ that comes with Java 8.
>
> I am having problems compiling many of the plugins that compiled fine on the old system.
>
> A first question - is how do I get the error log to show?  It either compiles or doesn't with no message.
>
> The second question is specific.  Here is an example of simple string manipulation that works with the old but not with the new:
> _________
> String filename = "hello";
> IJ.showMessage("test","o" + filename);
> _________
>
> It should display "ohello" and does so on the old system, but ruses to compile on the new.  It will work if I do not try to concatenate the two strings with the + sign.  e.g  IJ.showMessage("test",filename); will produce "hello."
>
> So where is my error message and does anyone have ideas on why concatenating strings with "+" works on the old and not the new?

An updated Mac version of ImageJ bundled with Java 1.8.0_60 is now available that should work better. It compiles and runs the following test plugin without a problem.

-wayne

   import ij.*;
   import ij.plugin.*;
   public class My_Plugin implements PlugIn {
       public void run(String arg) {
           String filename = "hello";
           IJ.showMessage("test","o" + filename);
       }
   }

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