Re-hi
now I'm trying to compile Mark R Besonen piece of code allowing to create folders using the macro language. Unfortunately, I get an exception error when I try to compile this : /** START "MakeDirectory_.java" code ** note that "mkdirs" (vs. "mkdir") makes ** all intermediate parent directories ** even if they don't yet exist */ import ij.*; import ij.plugin.*; import java.io.*; public class MakeDirectory_ implements PlugIn { String DirToMake = Macro.getOptions(); public void run(String arg) { File newDir = new File(DirToMake); newDir.mkdirs(); } } /** END "MakeDirectory_.java" code */ with "Compile and Run" command. The error is : java.lang.NullPointerException at java.io.File.<init>(File.java:194) at MakeDirectory_.run(MakeDirectory_.java:13) at ij.IJ.runUserPlugIn(Unknown Source) at ij.ImageJ.runUserPlugIn(Unknown Source) at ij.plugin.PlugInExecuter.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) I think I can't get to use the java.io class but I don't even know how to add it to ImageJ so it can use it. Any hint ? Christophe -- -- Christophe LETERRIER ------------------- Etudiant en thèse Equipe Dynamique des Récepteurs Neuronaux Laboratoire de Neurobiologie ESPCI-CNRS UMR 7637 10, rue Vauquelin 75231 Paris Cedex 05 Tel 01 40 79 51 84 Fax 01 40 79 47 67 [hidden email] |
Hello Christophe,
The java.io package is not a part of ImageJ itself, but is part of the Sun JVM package. I'm not sure why you are having this problem you have described below. But if you have not upgraded to the most recent JVM, you might want to try that since this has resolved several similar problems for me in the past. On another note, you might also want to change "MakeDirectory_" to "Make_Directory". So the resulting run() command would become "Make Directory" (space between words) instead of "MakeDirectory " (space after joined words). If you can't get compiling to work, I can send you a pre-compiled class file off-list. It is microscopic--less than 1 KB. Mark Besonen UMass Geosciences At 06:43 AM 10/25/2005, you wrote: >Re-hi > >now I'm trying to compile Mark R Besonen piece >of code allowing to create folders using the >macro language. Unfortunately, I get an >exception error when I try to compile this : > >/** START "MakeDirectory_.java" code ** note >that "mkdirs" (vs. "mkdir") makes ** all >intermediate parent directories ** even if they >don't yet exist */ import ij.*; import >ij.plugin.*; import java.io.*; public class >MakeDirectory_ implements PlugIn { String >DirToMake = Macro.getOptions(); public void >run(String arg) { File newDir = new >File(DirToMake); newDir.mkdirs(); } } /** END "MakeDirectory_.java" code */ > > > >with "Compile and Run" command. >The error is : > >java.lang.NullPointerException >at java.io.File.<init>(File.java:194) >at MakeDirectory_.run(MakeDirectory_.java:13) >at ij.IJ.runUserPlugIn(Unknown Source) >at ij.ImageJ.runUserPlugIn(Unknown Source) >at ij.plugin.PlugInExecuter.run(Unknown Source) >at java.lang.Thread.run(Thread.java:595) > >I think I can't get to use the java.io class but >I don't even know how to add it to ImageJ so it can use it. > >Any hint ? > >Christophe > >-- >-- Christophe LETERRIER ------------------- > >Etudiant en thèse >Equipe Dynamique des Récepteurs Neuronaux >Laboratoire de Neurobiologie >ESPCI-CNRS UMR 7637 >10, rue Vauquelin 75231 Paris Cedex 05 > >Tel 01 40 79 51 84 >Fax 01 40 79 47 67 >[hidden email] |
Free forum by Nabble | Edit this page |