UnsupportedClassVersionError

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

UnsupportedClassVersionError

Joris FA Meys
Dear all,

I have a plugin that worked fine until I added another class to the jar
file. That other class is actually another plugin that has to be bundled
with mine, but nothing from that class is used in the rest of the code.
Actually, I didn't change a thing in the code of my plugin.

Yet, this new bundle runs fine within ImageJ in Eclipse, but not anymore
with the other ImageJ I have on my computer. And when I run it on another
computer, it throws an UnsupportedClassVersionError.

As I didn't change anything in the original code, I'm a bit puzzled about
how this came about. Anybody has a clue?

Kind regards
Joris
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Joris FA Meys
To clarify : When I run it on the other version of ImageJ, the median filter
does not give the expected results. I use it in my code as :

RankFilters filter = new RankFilters();
        if (radius > 0)filter.rank(ip2, radius, RankFilters.MEDIAN);

On the Eclipse version, it does what it has to do. On the other version, it
renders the picture almost completely white.

Kind regards
Joris

On Fri, Feb 27, 2009 at 6:34 PM, joris meys <[hidden email]> wrote:

> Dear all,
>
> I have a plugin that worked fine until I added another class to the jar
> file. That other class is actually another plugin that has to be bundled
> with mine, but nothing from that class is used in the rest of the code.
> Actually, I didn't change a thing in the code of my plugin.
>
> Yet, this new bundle runs fine within ImageJ in Eclipse, but not anymore
> with the other ImageJ I have on my computer. And when I run it on another
> computer, it throws an UnsupportedClassVersionError.
>
> As I didn't change anything in the original code, I'm a bit puzzled about
> how this came about. Anybody has a clue?
>
> Kind regards
> Joris
>
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

ctrueden
In reply to this post by Joris FA Meys
Hi Joris,

The UnsupportedClassVersionError means that ImageJ is using an older version
of Java than the one used to compile the
plugin. Can you recompile all of your plugins in Eclipse setting the target
Java version to 1.4? Or if you do not have the original source, you could
try applying Retroweaver to your classes to make them 1.4-compatible:
http://retroweaver.sourceforge.net/

-Curtis

On Fri, Feb 27, 2009 at 11:34 AM, joris meys <[hidden email]> wrote:

> Dear all,
>
> I have a plugin that worked fine until I added another class to the jar
> file. That other class is actually another plugin that has to be bundled
> with mine, but nothing from that class is used in the rest of the code.
> Actually, I didn't change a thing in the code of my plugin.
>
> Yet, this new bundle runs fine within ImageJ in Eclipse, but not anymore
> with the other ImageJ I have on my computer. And when I run it on another
> computer, it throws an UnsupportedClassVersionError.
>
> As I didn't change anything in the original code, I'm a bit puzzled about
> how this came about. Anybody has a clue?
>
> Kind regards
> Joris
>
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Bill Mohler
Couldn't Joris also just update his ImageJ to the newest version with
the newest version of Java?

Bill


At 11:39 AM -0600 2/27/09, Curtis Rueden wrote:

>Hi Joris,
>
>The UnsupportedClassVersionError means that ImageJ is using an older version
>of Java than the one used to compile the
>plugin. Can you recompile all of your plugins in Eclipse setting the target
>Java version to 1.4? Or if you do not have the original source, you could
>try applying Retroweaver to your classes to make them 1.4-compatible:
>http://retroweaver.sourceforge.net/
>
>-Curtis
>
>On Fri, Feb 27, 2009 at 11:34 AM, joris meys <[hidden email]> wrote:
>
>>  Dear all,
>>
>>  I have a plugin that worked fine until I added another class to the jar
>>  file. That other class is actually another plugin that has to be bundled
>>  with mine, but nothing from that class is used in the rest of the code.
>>  Actually, I didn't change a thing in the code of my plugin.
>>
>>  Yet, this new bundle runs fine within ImageJ in Eclipse, but not anymore
>>  with the other ImageJ I have on my computer. And when I run it on another
>>  computer, it throws an UnsupportedClassVersionError.
>>
>>  As I didn't change anything in the original code, I'm a bit puzzled about
>>  how this came about. Anybody has a clue?
>>
>>  Kind regards
>>  Joris
>>
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

ctrueden
In reply to this post by ctrueden
Hi Bill,

Couldn't Joris also just update his ImageJ to the newest version with the
> newest version of Java?
>

Yep, but if he wants to distribute his plugin bundle to other people, who
may not have the latest Java with their ImageJ, some of them will inevitably
complain to him that they are receiving a cryptic error about
UnsupportedClassVersionError. :-)

-Curtis


On Fri, Feb 27, 2009 at 11:57 AM, Bill Mohler <[hidden email]>wrote:

> Couldn't Joris also just update his ImageJ to the newest version with the
> newest version of Java?
>
> Bill
>
>
>
> At 11:39 AM -0600 2/27/09, Curtis Rueden wrote:
>
>> Hi Joris,
>>
>> The UnsupportedClassVersionError means that ImageJ is using an older
>> version
>> of Java than the one used to compile the
>> plugin. Can you recompile all of your plugins in Eclipse setting the
>> target
>> Java version to 1.4? Or if you do not have the original source, you could
>> try applying Retroweaver to your classes to make them 1.4-compatible:
>> http://retroweaver.sourceforge.net/
>>
>> -Curtis
>>
>> On Fri, Feb 27, 2009 at 11:34 AM, joris meys <[hidden email]> wrote:
>>
>>   Dear all,
>>>
>>>  I have a plugin that worked fine until I added another class to the jar
>>>  file. That other class is actually another plugin that has to be bundled
>>>  with mine, but nothing from that class is used in the rest of the code.
>>>  Actually, I didn't change a thing in the code of my plugin.
>>>
>>>  Yet, this new bundle runs fine within ImageJ in Eclipse, but not anymore
>>>  with the other ImageJ I have on my computer. And when I run it on
>>> another
>>>  computer, it throws an UnsupportedClassVersionError.
>>>
>>>  As I didn't change anything in the original code, I'm a bit puzzled
>>> about
>>>  how this came about. Anybody has a clue?
>>>
>>>  Kind regards
>>>  Joris
>>>
>>>
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Joris FA Meys
Well, that's the funny thing. I thought so too, but both versions of the
plugin I wrote are compiled with the same JDK, they both contain exactly the
same code, and one gives the error while the other one doesn't. The only
difference is the packing in the jar file : the new one is packed with one
extra class, but one that isn't used in the code. It's just another plugin.
Can it be that another class is causing problems?

Plus, I have the strange behaviour of my median filter. There is something
else going on but I don't have a clue about what it can be.

Kind regards
Joris

On Fri, Feb 27, 2009 at 7:21 PM, Curtis Rueden <[hidden email]> wrote:

> Hi Bill,
>
> Couldn't Joris also just update his ImageJ to the newest version with the
> > newest version of Java?
> >
>
> Yep, but if he wants to distribute his plugin bundle to other people, who
> may not have the latest Java with their ImageJ, some of them will
> inevitably
> complain to him that they are receiving a cryptic error about
> UnsupportedClassVersionError. :-)
>
> -Curtis
>
>
> On Fri, Feb 27, 2009 at 11:57 AM, Bill Mohler <[hidden email]
> >wrote:
>
> > Couldn't Joris also just update his ImageJ to the newest version with the
> > newest version of Java?
> >
> > Bill
> >
> >
> >
> > At 11:39 AM -0600 2/27/09, Curtis Rueden wrote:
> >
> >> Hi Joris,
> >>
> >> The UnsupportedClassVersionError means that ImageJ is using an older
> >> version
> >> of Java than the one used to compile the
> >> plugin. Can you recompile all of your plugins in Eclipse setting the
> >> target
> >> Java version to 1.4? Or if you do not have the original source, you
> could
> >> try applying Retroweaver to your classes to make them 1.4-compatible:
> >> http://retroweaver.sourceforge.net/
> >>
> >> -Curtis
> >>
> >> On Fri, Feb 27, 2009 at 11:34 AM, joris meys <[hidden email]>
> wrote:
> >>
> >>   Dear all,
> >>>
> >>>  I have a plugin that worked fine until I added another class to the
> jar
> >>>  file. That other class is actually another plugin that has to be
> bundled
> >>>  with mine, but nothing from that class is used in the rest of the
> code.
> >>>  Actually, I didn't change a thing in the code of my plugin.
> >>>
> >>>  Yet, this new bundle runs fine within ImageJ in Eclipse, but not
> anymore
> >>>  with the other ImageJ I have on my computer. And when I run it on
> >>> another
> >>>  computer, it throws an UnsupportedClassVersionError.
> >>>
> >>>  As I didn't change anything in the original code, I'm a bit puzzled
> >>> about
> >>>  how this came about. Anybody has a clue?
> >>>
> >>>  Kind regards
> >>>  Joris
> >>>
> >>>
>
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Joris FA Meys
In reply to this post by Joris FA Meys
Dear all,

I've checked again, and on a ImageJ version 1.41 the plugin works. It used
to work on ImageJ 1.36, but after adding the other class, the median filter
doesn't work any more as it should in ImageJ 1.36. Yet, it did before I
added the other class...

Has anybody an idea about how classes can interfere with eachother when
there is no connection through the code what so ever, purely from being in
the same jar file?

I compile everything with compliance to Java 1.5 (lower doesn't work, as
parameterized types are only available as from 1.5).

Kind regards
Joris

On Fri, Feb 27, 2009 at 6:36 PM, joris meys <[hidden email]> wrote:

> To clarify : When I run it on the other version of ImageJ, the median
> filter does not give the expected results. I use it in my code as :
>
> RankFilters filter = new RankFilters();
>         if (radius > 0)filter.rank(ip2, radius, RankFilters.MEDIAN);
>
> On the Eclipse version, it does what it has to do. On the other version, it
> renders the picture almost completely white.
>
> Kind regards
> Joris
>
>
> On Fri, Feb 27, 2009 at 6:34 PM, joris meys <[hidden email]> wrote:
>
>> Dear all,
>>
>> I have a plugin that worked fine until I added another class to the jar
>> file. That other class is actually another plugin that has to be bundled
>> with mine, but nothing from that class is used in the rest of the code.
>> Actually, I didn't change a thing in the code of my plugin.
>>
>> Yet, this new bundle runs fine within ImageJ in Eclipse, but not anymore
>> with the other ImageJ I have on my computer. And when I run it on another
>> computer, it throws an UnsupportedClassVersionError.
>>
>> As I didn't change anything in the original code, I'm a bit puzzled about
>> how this came about. Anybody has a clue?
>>
>> Kind regards
>> Joris
>>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Gabriel Landini
On Saturday 28 February 2009, joris meys wrote:

> I've checked again, and on a ImageJ version 1.41 the plugin works. It used
> to work on ImageJ 1.36, but after adding the other class, the median filter
> doesn't work any more as it should in ImageJ 1.36. Yet, it did before I
> added the other class...
>
> Has anybody an idea about how classes can interfere with eachother when
> there is no connection through the code what so ever, purely from being in
> the same jar file?
>
> I compile everything with compliance to Java 1.5 (lower doesn't work, as
> parameterized types are only available as from 1.5).

Can you post the code or jar so somebody else can try?

G.
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Joris FA Meys
I would like to post the code, but it's in total over 2000 lines. That might
be a bit over the top...

By now, I figured out that it might be an incompatibility between ImageJ
versions. I use the jar of ImageJ 1.41 in my building environment. After
changing that to the jar of 1.36 and recompiling everything, the plugin
works on all versions of ImageJ I have on my own computer as it should.

A friend of mine tried out both jars as well, and came to the same
conclusions : the old one runs on ImageJ 1.37 in a Java 4 environment, the
new one gives the class-version error. In a Java 5 environment, it all runs
smooth.

I'm still puzzled as to why the extra class makes such a difference, but as
the problem is solved, I'm already quite satisfied. Thanks again for the
help and tips.

Kind regards
Joris


On Sat, Feb 28, 2009 at 3:29 PM, Gabriel Landini <[hidden email]>wrote:

>
>
> Can you post the code or jar so somebody else can try?
>
> G.
>
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Michael Schmid
In reply to this post by Joris FA Meys
Hi Joris,

the Rank filters have been changed in 1.38u, increasing their  
performance significantly (especially for large kernels), but  
unfortunately it seems that this has broken comparibility with  
previous versions. Sorry, I fear that this was my fault!

With the current version of the RankFilters, you need the following  
code:

   RankFilters rf = new RankFilters();
   rf.setup("median", null);
   rf.makeKernel(radius);
   rf.run(ip2);
(you can use rf.run with more than one ip after setup & makeKernel).

Best wishes,

Michael
________________________________________________________________

On Fri, Feb 27, 2009 at 6:36 PM, joris meys <[hidden email]> wrote:


> To clarify : When I run it on the other version of ImageJ, the median
> filter does not give the expected results. I use it in my code as :
>
> RankFilters filter = new RankFilters();
>         if (radius > 0)filter.rank(ip2, radius, RankFilters.MEDIAN);
>
> On the Eclipse version, it does what it has to do. On the other  
> version, it
> renders the picture almost completely white.
Reply | Threaded
Open this post in threaded view
|

Re: UnsupportedClassVersionError

Joris FA Meys
Hi Michael,

thanks for the tip. I guessed something like that already, that's why I
compiled the classes with the ij-jar file of ImageJ 1.36, and it works.
Actually, the code as I used it works also with later versions of ImageJ (at
least with 1.41), but when the plugin gets compiled in that environment, it
doesn't any more in earlier versions.

Anyway, the use of the rankfilters as you described, seems more convenient
anyway. I keep it in mind for the next one. Thanks!

Kind regards
Joris

On Mon, Mar 2, 2009 at 10:17 AM, Michael Schmid <[hidden email]>wrote:

> Hi Joris,
>
> the Rank filters have been changed in 1.38u, increasing their performance
> significantly (especially for large kernels), but unfortunately it seems
> that this has broken comparibility with previous versions. Sorry, I fear
> that this was my fault!
>
> With the current version of the RankFilters, you need the following code:
>
>  RankFilters rf = new RankFilters();
>  rf.setup("median", null);
>  rf.makeKernel(radius);
>  rf.run(ip2);
> (you can use rf.run with more than one ip after setup & makeKernel).
>
> Best wishes,
>
> Michael
> ________________________________________________________________
>
>
> On Fri, Feb 27, 2009 at 6:36 PM, joris meys <[hidden email]> wrote:
>
>
>  To clarify : When I run it on the other version of ImageJ, the median
>> filter does not give the expected results. I use it in my code as :
>>
>> RankFilters filter = new RankFilters();
>>        if (radius > 0)filter.rank(ip2, radius, RankFilters.MEDIAN);
>>
>> On the Eclipse version, it does what it has to do. On the other version,
>> it
>> renders the picture almost completely white.
>>
>