Problem compilating in Fiji

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

Problem compilating in Fiji

GeraldT
Hi everybody:

I have lately had lot of problems compiling my plugins in FIJI. Now I cannot even compile them if the classes are in separate files. I think the problem comes because the files are compilated in a temporary folder: "Compiling 1 file in C:\Users\gerald\AppData\Local\Temp\java8777501615926510709" and not where the java files are. It does not happen on another computer where Fiji is installed. I have tried to delete the Fiji.app folder and download a clean version of Fiji, but without success. Anybody has an idea what I can do?

Here is the whole message I get on compiling:
Started CBCT_QA_MOA_A.java at Wed Oct 15 10:24:38 CEST 2014
Compiling 1 file in C:\Users\gerald\AppData\Local\Temp\java8777501615926510709
C:\Users\gerald\AppData\Local\Temp\java8777501615926510709\src\main\java\CBCT_QA_MOA_A.java:55: cannot find symbol
symbol  : class MOA_Phantom
location: class CBCT_QA_MOA_A
        private MOA_Phantom phantom;
                ^
C:\Users\gerald\AppData\Local\Temp\java8777501615926510709\src\main\java\CBCT_QA_MOA_A.java:55: cannot find symbol
symbol  : class MOA_Phantom
location: class CBCT_QA_MOA_A
        private MOA_Phantom phantom;
                ^
1 error
java.lang.RuntimeException: org.scijava.minimaven.JavaCompiler$CompileError: Compile error: 1
        at org.scijava.plugins.scripting.java.JavaEngine.printOrThrow(JavaEngine.java:252)
        at org.scijava.plugins.scripting.java.JavaEngine.compile(JavaEngine.java:211)
        at net.imagej.ui.swing.script.TextEditor$23.run(TextEditor.java:2172)
Caused by: org.scijava.minimaven.JavaCompiler$CompileError: Compile error: 1
        at org.scijava.minimaven.JavaCompiler.call(JavaCompiler.java:80)
        at org.scijava.minimaven.MavenProject.build(MavenProject.java:477)
        at org.scijava.minimaven.MavenProject.build(MavenProject.java:406)
        at org.scijava.minimaven.MavenProject.build(MavenProject.java:391)
        at org.scijava.minimaven.MavenProject.build(MavenProject.java:377)
        at org.scijava.plugins.scripting.java.JavaEngine.compile(JavaEngine.java:206)
        ... 1 more
Compilation finished.

The same files  compile on the other computer. Sadly the one giving me problems is my main workstation.


Greetings
Gerald R. Torgersen
IT-seksjonen,
Det odontologiske fakultet / Faculty of Dentistry
Universitetet i Oslo / University of Oslo

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

Re: Problem compilating in Fiji

dscho
Hi Gerald,

On Wed, 15 Oct 2014, Gerald Ruiner Torgersen wrote:

> I have lately had lot of problems compiling my plugins in FIJI. Now I
> cannot even compile them if the classes are in separate files.

Why not make it a multi-file project explicitly? It is easy:

1. make a src/main/java directory
2. move all .java files there
3. (optional) if you have non-.java files (such as plugins.config) as part
   of your project, make a src/main/resources directory and put them there
4. add a very simply pom.xml file (see below)
5. open your plugin class in the script editor

The contents of the pom.xml describe your project:

        <?xml version="1.0" encoding="UTF-8"?>
        <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
            http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>

          <groupId>sc.fiji</groupId>
          <artifactId>Geralds_Plugins</artifactId>
          <version>1.0.0-SNAPSHOT</version>

          <dependencies>
            <dependency>
              <groupId>net.imagej</groupId>
              <artifactId>ij</artifactId>
              <version>1.49i</version>
            </dependency>
          </dependencies>
        </project>

It might sound like overkill to write such a pom.xml. However, Fiji/ImageJ
is centered around a collaborative community, and collaboration is
facilitated by using common ways to develop projects, as it makes it
easier to reuse libraries (both third-party libraries in your project, as
well as your project in other developers' software).

For more information, see http://imagej.net/Maven. Contributions welcome.

Ciao,
Johannes

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

Re: Problem compilating in Fiji

GeraldT
Thank you Johannes:

I know I should do it that way. I tried several times to look at maven or use an IDE, but have never had the time to really get  going with it.
I will try once more with the structure and xml you provided.

The strange thing is that the Fiji  works the old way on my other machine. So I believe there might be some setting telling Fiji to compile in the temp directory and not in the source directory?

Mvh
Gerald R. Torgersen


>-----Original Message-----
>From: Johannes Schindelin [mailto:[hidden email]]
>Sent: Wednesday, October 15, 2014 2:00 PM
>To: Gerald Ruiner Torgersen
>Cc: [hidden email]
>Subject: Re: Problem compilating in Fiji
>
>Hi Gerald,
>
>On Wed, 15 Oct 2014, Gerald Ruiner Torgersen wrote:
>
>> I have lately had lot of problems compiling my plugins in FIJI. Now I
>> cannot even compile them if the classes are in separate files.
>
>Why not make it a multi-file project explicitly? It is easy:
>
>1. make a src/main/java directory
>2. move all .java files there
>3. (optional) if you have non-.java files (such as plugins.config) as part
>   of your project, make a src/main/resources directory and put them there 4.
>add a very simply pom.xml file (see below) 5. open your plugin class in the
>script editor
>
>The contents of the pom.xml describe your project:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>    http://maven.apache.org/xsd/maven-4.0.0.xsd">
>  <modelVersion>4.0.0</modelVersion>
>
>  <groupId>sc.fiji</groupId>
>  <artifactId>Geralds_Plugins</artifactId>
>  <version>1.0.0-SNAPSHOT</version>
>
>  <dependencies>
>    <dependency>
>      <groupId>net.imagej</groupId>
>      <artifactId>ij</artifactId>
>      <version>1.49i</version>
>    </dependency>
>  </dependencies>
> </project>
>
>It might sound like overkill to write such a pom.xml. However, Fiji/ImageJ is
>centered around a collaborative community, and collaboration is facilitated by
>using common ways to develop projects, as it makes it easier to reuse libraries
>(both third-party libraries in your project, as well as your project in other
>developers' software).
>
>For more information, see http://imagej.net/Maven. Contributions welcome.
>
>Ciao,
>Johannes

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

Re: Problem compilating in Fiji

dscho
Hi Gerald,

On Wed, 15 Oct 2014, Gerald Ruiner Torgersen wrote:

> I know I should do it that way. I tried several times to look at maven
> or use an IDE, but have never had the time to really get  going with it.
> I will try once more with the structure and xml you provided.

You might want to create your own GitHub repository for that, to make it
easier for other people to help.

Ciao,
Johannes

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

Re: Problem compilating in Fiji

GeraldT
Thank you again. I will do this from scratch on my next project, I promise :-)

The problem now is that I am using the PDFWriter plugin which does not seem to work with the maven and all that.
So my solution is to "downgrade" to a Fiji-version from May this year which still works the old way. Can somebody tell me which update changes Fiji to compile in the temporary folder instead of where the java-files are? Because I cannot do updates on that Fiji without getting the problem again.


Mvh
Gerald R. Torgersen

>-----Original Message-----
>From: Johannes Schindelin [mailto:[hidden email]]
>Sent: Wednesday, October 15, 2014 5:06 PM
>To: Gerald Ruiner Torgersen
>Cc: [hidden email]
>Subject: Re: Problem compilating in Fiji
>
>Hi Gerald,
>
>On Wed, 15 Oct 2014, Gerald Ruiner Torgersen wrote:
>
>> I know I should do it that way. I tried several times to look at maven
>> or use an IDE, but have never had the time to really get  going with it.
>> I will try once more with the structure and xml you provided.
>
>You might want to create your own GitHub repository for that, to make it
>easier for other people to help.
>
>Ciao,
>Johannes

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

Re: Problem compilating in Fiji

dscho
Hi Gerald,

On Thu, 16 Oct 2014, Gerald Ruiner Torgersen wrote:

> The problem now is that I am using the PDFWriter plugin which does not
> seem to work with the maven and all that.

If you are referring to Fiji's File>Save As>PDF, it is actually part of
the IO_.jar artifact, generated by a Maven project:

        https://github.com/fiji/IO/blob/master/src/main/java/io/PDF_Writer.java

Ciao,
Johannes

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

Re: Problem compilating in Fiji

GeraldT
Thank you again Johannes :-)

This was the one, but I used the one from ImageJ's plugin page. Now I entered the one you sent me and added:
<dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>5.1.1</version>
</dependency>
to the pom.xml file. Now it works. I might end up as a real programmer :-)

Mvh
Gerald R. Torgersen


>-----Original Message-----
>From: Johannes Schindelin [mailto:[hidden email]]
>Sent: Thursday, October 16, 2014 1:59 PM
>To: Gerald Ruiner Torgersen
>Cc: [hidden email]
>Subject: Re: Problem compilating in Fiji
>
>Hi Gerald,
>
>On Thu, 16 Oct 2014, Gerald Ruiner Torgersen wrote:
>
>> The problem now is that I am using the PDFWriter plugin which does not
>> seem to work with the maven and all that.
>
>If you are referring to Fiji's File>Save As>PDF, it is actually part of the IO_.jar
>artifact, generated by a Maven project:
>
> https://github.com/fiji/IO/blob/master/src/main/java/io/PDF_Writer.
>java
>
>Ciao,
>Johannes

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