Hello everybody,

Error:

After specifying the Mobilink server to use synchronization scripts I get this error: "Unsupported major.minor version 51.0"

Command to compile:

I wrote the Java code and compile using this command in the command line:

javac -classpath "%SQLANY12%\java\mlscript.jar" MobielCMPSynchronization.java

Cause of the problem:

I googled around and find out this has to do with the Java JDK version compatibility problem: "It means that you compiled your classes under a specific JDK, but then try to run them under older version of JDK." I have JDK7 installed and use JDK7 to compile the code. Why does it generate this error, since I don't compile and run against different JDK versions...

Tried the following:

So what I did was I downloaded & installed the older JDK version which is JDK 6.0. In the Eclipse project I specify the JRE to the version 6 (JavaSE-1.6) as the execution environment. So the compiler is using the 1.6 version. I use the command line to run the compile Java classes command.

I'm still getting this error. :( Any idea what I can do next... I'm confused now since I have two versions of the JDK now.

asked 31 Jan '12, 05:12

Yanny's gravatar image

Yanny
1767917
accept rate: 75%

edited 31 Jan '12, 05:14

2

You could use mlsrv12 -sl java with the -jrepath option to specify the right JRE - if it isn't the default one included with SQL Anywhere 12. - Are the settings of JAVA_HOME different?

(31 Jan '12, 06:31) Volker Barth

What is the default JRE being used by SQLAnywhere 12? How can I check the settings of JAVA_HOME?

(31 Jan '12, 06:48) Yanny
Replies hidden
2

The other option, if you are not using any JDK1.7 specific features, is to compile with the -target option so that you force it to run against an older JRE.

(31 Jan '12, 07:18) Chris Keating
Replies hidden
1

From the cited doc:

-jrepath
Override the default JRE path, which is the directory %SQLANY12%\Sun\jre160_chip (where chip is a supported chip, such as x86).

For the JAVA_HOME, as with any other environment varible in Windows, check within a cmd window with SET JAVA_HOME, or use the Workplace properties dialogs.

(31 Jan '12, 07:23) Volker Barth
Comment Text Removed

I have overriden the -jrepath:

mlsrv12 -c "dsn=mobiel-cmp;uid=xxx;pwd=xxx" -x http(host=109.205.192.234;port=3306) -v -sl java (-cp "c:\Users\yanling.ch_expericom\Desktop\SQLAnywhere db\synchronization scripts" -jrepath "%SQLANY12%\Sun\jre160_x64")

But still getting this error...

(02 Feb '12, 03:35) Yanny

When I compile forcing it to use 1.6 version I get this error:

javac: target release 1.6 conflicts with default source release 1.7
(02 Feb '12, 03:59) Yanny
1

IMHO, the given command line just sets the JRE to the default one... I would have expected that you set it to your freshly downloaded JRE.

(02 Feb '12, 04:10) Volker Barth
showing 3 of 7 show all flat view

Ok, I fixed this problem by removing the 1.7 version in the control panel > remove software.

Compiled the class using -target 1.6 and specified the -jrepath to use "%SQLANY12%Sunjre160_x64" as value when starting the Mobilink server.

permanent link

answered 02 Feb '12, 05:19

Yanny's gravatar image

Yanny
1767917
accept rate: 75%

Just to close this "completely": Does this work without specifying the -jrepath, too?

I would think so as the specified version should be used by default.

(02 Feb '12, 07:24) Volker Barth
Replies hidden

Yes, it works without specifying the -jrepath.

(02 Feb '12, 07:52) Yanny
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×290
×74
×64

question asked: 31 Jan '12, 05:12

question was seen: 1,460 times

last updated: 02 Feb '12, 07:52