UnsupportedClassVersionError with MATLAB

Howdy,

I'm trying to build an external library for use with MATLAB. However, I keep getting UnsupportedClassVersionError when I try to run my program in MATLAB.

In MATLAB, the Java version is 1.5.0_07. I'm compiling with JDK1.6.0. I've tried setting the source command to different things, like source="1.5", source="1.4", but to no avail.

Is there some way to solve this that I am missing? I am downloading JDK1.5.0_07, but I have a pessimistic feeling.

Can anyone please offer any suggestions?

Thanks,

Dan

[554 byte] By [Djaunla] at [2007-11-27 7:05:08]
# 1
along with source you did "target=" right, lol? ; )
TuringPesta at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 2

> along with source you did "target=" right, lol? ; )

Yes, I did. I'm using Ant by the way.

<!-- Compile the Java code -->

<target name="compile" depends="init">

<javac srcdir="${src}" destdir="${build}" source="1.5" target="1.5">

<classpath refid="classpath" />

</javac>

</target>

This is really driving me crazy.

Message was edited by:

Djaunl

Djaunla at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 3
Why don't you just use a 1.5 compiler?
jschella at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 4

> Why don't you just use a 1.5 compiler?

Well, I'm trying to use a different compiler, but I can't get one working well on my UNIX box.

According to the documentation:

To define new Java classes and subclasses of existing classes, you must

use a Java development environment, external to MATLAB, that supports Java

version 1.4.2. You can download the development kit from the Sun Microsystems

Web site, (http://java.sun.com/j2se/).

The Sun site also provides documentation for the Java language and classes

that you will need for development.After you create class definitions in .java files,

use your Java compiler to produce .class files from them.

The next step is to make the class definitions in those .class files

available for you to use in MATLAB.

I've tried compiling to 1.4, but no luck. Guess this means I'll have to download an earlier JDK.

I can't seem to get one installed correctly for my Solaris box, which is what I'm building from.

Djaunla at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 5
Since you shelled out the $$$ for MATLAB will they give any tech support?
TuringPesta at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 6
> Since you shelled out the $$$ for MATLAB will they> give any tech support?That would truly make my day. Guess I'll check.
Djaunla at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 7
> This is really driving me crazy.Did you delete the old class files?
jsalonena at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 8

> > This is really driving me crazy.

>

> Did you delete the old class files?

I deleted some old class files (as many as I could find), changed some directories around, and rebuilt my project. The UnsupportedClassVersionError is now gone!!!

jsalonen, I truly love you. I would show my love with Dukes, but I get an internal server error whenever I try to assign any to the thread.

I was about five minutes away from throwing my computer out the window. Thank god.

Thanks a lot to everyone who replied!

Djaunla at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...
# 9
IT WORKS! IT ACTUALLY FRICKIN' WORKS!YES!!! YES!!! YES!!!
Djaunla at 2007-7-12 18:56:27 > top of Java-index,Java Essentials,Java Programming...