Ant build problems - Java version

For discussions about the source code and how to get involved in the development of muCommander.

Ant build problems - Java version

Postby leo_08_15 » Mon Jun 15, 2009 5:28 pm

I am trying to run the ant-build task under Eclipse on Windows and this fails due to

[javac] D:\E2L\workspace\muCommander\source\com\mucommander\xml\XmlAttributesTest.java:21: cannot access junit.framework.TestCase
[javac] bad class file: D:\E2L\workspace\muCommander\lib\noinclude\junit.jar(junit/framework/TestCase.class)
[javac] class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac] import junit.framework.TestCase;
[javac] ^
[javac] 1 error

BUILD FAILED

Q1: Does this mean the checked in version is not 1.4 compatible? If not, then why have the whole project as 1.4?

Q2: Can anyone help me to assist how to get it run on Windows under Eclipse???? (resp. which task should be selected to let it run - I assume it is run, but ...)
leo_08_15
 
Posts: 28
Joined: Thu Jun 11, 2009 8:13 pm

Re: Newbies questions - part 4 (java 1.4 + Ant)

Postby Nicolas » Tue Jun 16, 2009 9:14 am

Hey,

Well, muCommander is a bit weird that way: we juggle a bit between Java versions. The source uses APIs that are 1.6 only (file permissions, for example) but its bytecode needs to be 1.4 compatible. We analyse the Java version at runtime and ignore incompatible APIs.

In order for muCommander to compile, you need to do precisely what is done in the buildfile: compile with a 1.6 VM, but with a target bytecode of 1.4. This, unfortunately, means that you can't use foreach statements, Enums, and all of these new things. Moreover, if you want your code to make it to the repository, you need to be careful not to embed 1.5+ only code - either in imported libraries or in your own code. This is a common issue, one that all muCommander developers have fallen prey to at least once.

Hope that helps!

Nicolas
User avatar
Nicolas
 
Posts: 831
Joined: Mon Oct 02, 2006 10:36 pm
Location: France


Return to Developer's corner

Who is online

Users browsing this forum: No registered users and 1 guest

cron