Java compilation, invalid directory

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Java compilation, invalid directory

Dominic Waithe
Hi,
I think I have a bug.
I am writing java plugin am converting them to Java which is easy. My problem is that when I try and compile the Java code using the script editor I get the following error:

javax.script.ScriptException: Class GP_PlugIn in invalid directory: /Users/dwaithe/Documents/collaborators/SezginE/bin/GP_Plugin.java
        at org.scijava.plugins.scripting.java.JavaEngine.getMavenProject(JavaEngine.java:369)
        at org.scijava.plugins.scripting.java.JavaEngine.access$600(JavaEngine.java:94)
        at org.scijava.plugins.scripting.java.JavaEngine$Builder.<init>(JavaEngine.java:324)
        at org.scijava.plugins.scripting.java.JavaEngine$Builder.<init>(JavaEngine.java:267)
        at org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:149)
        at org.scijava.script.ScriptModule.run(ScriptModule.java:172)
        at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
        at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
        at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
        at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:695)

When I take a template script and save it to the same location it compiles:
Started Bare_PlugIn.java at Thu Jul 17 10:26:24 BST 2014
Compiling 1 file in /var/folders/_6/zby9xbls1d15wqlkpgv9k3280000gn/T/java6346724649962674232

I am using latest Fiji. Please can you help me work this out.
Best,
Dominic

p.s.
Here is the script:

import ij.plugin.PlugIn;
import ij.plugin.PlugIn;
import ij.*;
import ij.ImagePlus.*;
import ij.gui.*;
import ij.measure.*;
import ij.plugin.*;
import ij.plugin.frame.*;
import ij.process.*;
import javax.swing.*;
import java.awt.*;
/**
 * This is a template for a plugin that does not require one image
 * (be it that it does not require any, or that it lets the user
 * choose more than one image in a dialog).
 */
public class GP_PlugIn implements PlugIn {
        /**
         * This method gets called by ImageJ / Fiji.
         *
         * @param arg can be specified in plugins.config
         * @see ij.plugin.PlugIn#run(java.lang.String)
         */
        JFrame frame;
        JPanel superPanel;
        JComboBox menu1, menu2;
        JCheckBox checkBox;
        GridBagConstraints c;
        JButton calculateBtn, editBtn;
        JSpinner noiseTol, thresholdText,wavelengthHighJS,wavelengthLowJS;
        ImagePlus imp;
        int nbImg =0;
        String[] fileList ={};

        private static int wavelengthHigh = 1;
        private static int wavelengthLow = 2;
        private static String[] fitStrings = { "Gaussian", "Gamma Variate"};

        public void getParam(){
        imp = WindowManager.getImage("blobs.gif");
               
               
                }
        public void reloadList(){
                menu1.removeAllItems();
                nbImg=0;
       
        int selectA=menu1.getSelectedIndex();
       
        if (WindowManager.getImageCount()!=0){
            int[] IDList=WindowManager.getIDList();
            for (int i=0;i<IDList.length;i++){
                ImagePlus currImg=WindowManager.getImage(IDList[i]);
                if (currImg.getBitDepth()!=24 && currImg.getBitDepth()!=32){
                    nbImg++;
                    item = currImg.getTitle();
                    menu1.addItem(item);
                   
                }
            }
        }
                }
        public void addImgToList(ImagePlus img){
        int min=65535, max=0;
        for (int i=1; i<=img.getNSlices(); i++){
            img.setSlice(i);
            min=Math.min(min, (int) img.getStatistics().min);
            max=Math.max(max, (int) img.getStatistics().max);
        }
        info.addElement(new ImgInfo(img.getTitle(), min, max, img.getProcessor().getAutoThreshold()));
    }


        public void GUI(){
                /**Loads the main GUI interface **/
                frame = new JFrame("Channels");
                superPanel = new JPanel(new GridBagLayout());
                frame.add(superPanel);
                frame.setSize(400,585);
                c = new GridBagConstraints();
                c.fill = GridBagConstraints.HORIZONTAL;
               
               
                c.gridx = 1;c.gridy = 1;
                menu1= new JComboBox(fileList);
                               
                superPanel.add(new JLabel("input Stack: "),c);
                c.gridx = 2;c.gridy = 1;
               
                superPanel.add(menu1,c);
                menu2=new JComboBox(fitStrings);
               
                c.gridx = 1;c.gridy = 2;
                superPanel.add(new JLabel("Model to fit: "),c);
               
                c.gridx = 2;c.gridy = 2;
                superPanel.add(menu2,c);
               
                c.gridx = 1;c.gridy = 3;
                superPanel.add(new JLabel("Remove Background: "),c);
               
                c.gridx = 2;c.gridy = 3;
                checkBox = new JCheckBox();
                superPanel.add(checkBox,c);
               
                c.gridx = 2;c.gridy = 4;
                editBtn = new JButton("Edit wavelengths");
                //editBtn.addActionListener(openWavelengthBox());
                superPanel.add(editBtn,c);
                c.gridx =1;c.gridy =5;
               
                superPanel.add(new JLabel("sample wavelength low"),c);
                c.gridx =2;
               
                wavelengthLowJS = new  JSpinner(new SpinnerNumberModel(1,0,1,1));
                superPanel.add(wavelengthLowJS,c);
                c.gridx =1;c.gridy =6;
               
                superPanel.add(new JLabel("sample wavelength high"),c);
                c.gridx =2;
               
                wavelengthHighJS = new JSpinner(new SpinnerNumberModel(1,0,1,1));
                superPanel.add(wavelengthHighJS,c);
                c.gridx =1;c.gridy =7;
               
                superPanel.add(new JLabel("threshold (0-255)"),c);
                c.gridx =2;
                thresholdText = new JSpinner(new SpinnerNumberModel(41,0,255,1));
                superPanel.add(thresholdText,c);
                c.gridx =1;c.gridy =8;
               
                superPanel.add(new JLabel("Noise tolerance (0-1.0)"),c);
                c.gridx =2;
               
                noiseTol = new JSpinner(new SpinnerNumberModel(0.8,0.0,1.0,0.05));
                superPanel.add(noiseTol,c);
               
                calculateBtn = new JButton("calculate");
                //calculateBtn.addActionListener(processImg());
               
                c.gridx = 2;c.gridy = 9;
                superPanel.add(calculateBtn,c);
               
                c.gridy =10;

               
                frame.setVisible(true);
               
                }
       
        @Override
        public void run(String arg) {
                GUI();
                reloadList();
        }
       
}








Wolfson Imaging Centre.
Weatherall Institute of Molecular Medicine.
University of Oxford,
Oxford, OX3 9DS

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

Re: Java compilation, invalid directory

ctrueden
Hi all,

> javax.script.ScriptException: Class GP_PlugIn in invalid directory:
> /Users/dwaithe/Documents/collaborators/SezginE/bin/GP_Plugin.java

For the archives: Dominic followed up with a bug in the BugZilla:

   http://fiji.sc/bugzilla/show_bug.cgi?id=860

Regards,
Curtis


On Thu, Jul 17, 2014 at 4:31 AM, Dominic Waithe <[hidden email]
> wrote:

> Hi,
> I think I have a bug.
> I am writing java plugin am converting them to Java which is easy. My
> problem is that when I try and compile the Java code using the script
> editor I get the following error:
>
> javax.script.ScriptException: Class GP_PlugIn in invalid directory:
> /Users/dwaithe/Documents/collaborators/SezginE/bin/GP_Plugin.java
>         at
> org.scijava.plugins.scripting.java.JavaEngine.getMavenProject(JavaEngine.java:369)
>         at
> org.scijava.plugins.scripting.java.JavaEngine.access$600(JavaEngine.java:94)
>         at
> org.scijava.plugins.scripting.java.JavaEngine$Builder.<init>(JavaEngine.java:324)
>         at
> org.scijava.plugins.scripting.java.JavaEngine$Builder.<init>(JavaEngine.java:267)
>         at
> org.scijava.plugins.scripting.java.JavaEngine.eval(JavaEngine.java:149)
>         at org.scijava.script.ScriptModule.run(ScriptModule.java:172)
>         at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
>         at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
>         at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
>         at
> org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:164)
>         at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>         at java.lang.Thread.run(Thread.java:695)
>
> When I take a template script and save it to the same location it compiles:
> Started Bare_PlugIn.java at Thu Jul 17 10:26:24 BST 2014
> Compiling 1 file in
> /var/folders/_6/zby9xbls1d15wqlkpgv9k3280000gn/T/java6346724649962674232
>
> I am using latest Fiji. Please can you help me work this out.
> Best,
> Dominic
>
> p.s.
> Here is the script:
>
> import ij.plugin.PlugIn;
> import ij.plugin.PlugIn;
> import ij.*;
> import ij.ImagePlus.*;
> import ij.gui.*;
> import ij.measure.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
> import ij.process.*;
> import javax.swing.*;
> import java.awt.*;
> /**
>  * This is a template for a plugin that does not require one image
>  * (be it that it does not require any, or that it lets the user
>  * choose more than one image in a dialog).
>  */
> public class GP_PlugIn implements PlugIn {
>         /**
>          * This method gets called by ImageJ / Fiji.
>          *
>          * @param arg can be specified in plugins.config
>          * @see ij.plugin.PlugIn#run(java.lang.String)
>          */
>         JFrame frame;
>         JPanel superPanel;
>         JComboBox menu1, menu2;
>         JCheckBox checkBox;
>         GridBagConstraints c;
>         JButton calculateBtn, editBtn;
>         JSpinner noiseTol, thresholdText,wavelengthHighJS,wavelengthLowJS;
>         ImagePlus imp;
>         int nbImg =0;
>         String[] fileList ={};
>
>         private static int wavelengthHigh = 1;
>         private static int wavelengthLow = 2;
>         private static String[] fitStrings = { "Gaussian", "Gamma
> Variate"};
>
>         public void getParam(){
>         imp = WindowManager.getImage("blobs.gif");
>
>
>                 }
>         public void reloadList(){
>                 menu1.removeAllItems();
>                 nbImg=0;
>
>         int selectA=menu1.getSelectedIndex();
>
>         if (WindowManager.getImageCount()!=0){
>             int[] IDList=WindowManager.getIDList();
>             for (int i=0;i<IDList.length;i++){
>                 ImagePlus currImg=WindowManager.getImage(IDList[i]);
>                 if (currImg.getBitDepth()!=24 &&
> currImg.getBitDepth()!=32){
>                     nbImg++;
>                     item = currImg.getTitle();
>                     menu1.addItem(item);
>
>                 }
>             }
>         }
>                 }
>         public void addImgToList(ImagePlus img){
>         int min=65535, max=0;
>         for (int i=1; i<=img.getNSlices(); i++){
>             img.setSlice(i);
>             min=Math.min(min, (int) img.getStatistics().min);
>             max=Math.max(max, (int) img.getStatistics().max);
>         }
>         info.addElement(new ImgInfo(img.getTitle(), min, max,
> img.getProcessor().getAutoThreshold()));
>     }
>
>
>         public void GUI(){
>                 /**Loads the main GUI interface **/
>                 frame = new JFrame("Channels");
>                 superPanel = new JPanel(new GridBagLayout());
>                 frame.add(superPanel);
>                 frame.setSize(400,585);
>                 c = new GridBagConstraints();
>                 c.fill = GridBagConstraints.HORIZONTAL;
>
>
>                 c.gridx = 1;c.gridy = 1;
>                 menu1= new JComboBox(fileList);
>
>                 superPanel.add(new JLabel("input Stack: "),c);
>                 c.gridx = 2;c.gridy = 1;
>
>                 superPanel.add(menu1,c);
>                 menu2=new JComboBox(fitStrings);
>
>                 c.gridx = 1;c.gridy = 2;
>                 superPanel.add(new JLabel("Model to fit: "),c);
>
>                 c.gridx = 2;c.gridy = 2;
>                 superPanel.add(menu2,c);
>
>                 c.gridx = 1;c.gridy = 3;
>                 superPanel.add(new JLabel("Remove Background: "),c);
>
>                 c.gridx = 2;c.gridy = 3;
>                 checkBox = new JCheckBox();
>                 superPanel.add(checkBox,c);
>
>                 c.gridx = 2;c.gridy = 4;
>                 editBtn = new JButton("Edit wavelengths");
>                 //editBtn.addActionListener(openWavelengthBox());
>                 superPanel.add(editBtn,c);
>                 c.gridx =1;c.gridy =5;
>
>                 superPanel.add(new JLabel("sample wavelength low"),c);
>                 c.gridx =2;
>
>                 wavelengthLowJS = new  JSpinner(new
> SpinnerNumberModel(1,0,1,1));
>                 superPanel.add(wavelengthLowJS,c);
>                 c.gridx =1;c.gridy =6;
>
>                 superPanel.add(new JLabel("sample wavelength high"),c);
>                 c.gridx =2;
>
>                 wavelengthHighJS = new JSpinner(new
> SpinnerNumberModel(1,0,1,1));
>                 superPanel.add(wavelengthHighJS,c);
>                 c.gridx =1;c.gridy =7;
>
>                 superPanel.add(new JLabel("threshold (0-255)"),c);
>                 c.gridx =2;
>                 thresholdText = new JSpinner(new
> SpinnerNumberModel(41,0,255,1));
>                 superPanel.add(thresholdText,c);
>                 c.gridx =1;c.gridy =8;
>
>                 superPanel.add(new JLabel("Noise tolerance (0-1.0)"),c);
>                 c.gridx =2;
>
>                 noiseTol = new JSpinner(new
> SpinnerNumberModel(0.8,0.0,1.0,0.05));
>                 superPanel.add(noiseTol,c);
>
>                 calculateBtn = new JButton("calculate");
>                 //calculateBtn.addActionListener(processImg());
>
>                 c.gridx = 2;c.gridy = 9;
>                 superPanel.add(calculateBtn,c);
>
>                 c.gridy =10;
>
>
>                 frame.setVisible(true);
>
>                 }
>
>         @Override
>         public void run(String arg) {
>                 GUI();
>                 reloadList();
>         }
>
> }
>
>
>
>
>
>
>
>
> Wolfson Imaging Centre.
> Weatherall Institute of Molecular Medicine.
> University of Oxford,
> Oxford, OX3 9DS
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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