I'm using solaris, I created a maven app on jdk 1.6 but using the maven-compiler-plugin to specify the target as 1.5. Here is the snippet of my pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Although when I try to run in the solaris box I get:
bash-2.05$ ./merchantInfoUpdate.sh Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
And if I run the mvn install -X
(with debug) and the compiler plugin tells me:
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile' --> [DEBUG] (f) basedir = /home/emerson/newworkspace/java-batch-updater [DEBUG] (f) buildDirectory = /home/emerson/newworkspace/java-batch-updater/target [DEBUG] (f) classpathElements = [/home/emerson/newworkspace/java-batch-updater/target/classes, /home/emerson/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar, /home/emerson/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar] [DEBUG] (f) compileSourceRoots = [/home/emerson/newworkspace/java-batch-updater/src/main/java] [DEBUG] (f) compilerId = javac [DEBUG] (f) debug = true [DEBUG] (f) failOnError = true [DEBUG] (f) fork = false [DEBUG] (f) optimize = false [DEBUG] (f) outputDirectory = /home/emerson/newworkspace/java-batch-updater/target/classes [DEBUG] (f) outputFileName = com.company.ingestion.updater-2010.01 [DEBUG] (f) projectArtifact = com.yell:com.company.ingestion.updater:jar:2010.01 [DEBUG] (f) showDeprecation = false [DEBUG] (f) showWarnings = false [DEBUG] (f) source = 1.5 [DEBUG] (f) staleMillis = 0 [DEBUG] (f) target = 1.5 [DEBUG] (f) verbose = false emerson@emerson-desktop:~/newworkspace/java-batch-updater/target/expand$ file com/yell/ingestion/updater/ListingsManager.class com/yell/ingestion/updater/ListingsManager.class: compiled Java class data, version 50.0 (Java 1.6)
Java version:
bash-2.05$ java -version java version "1.5.0_05" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05) Java HotSpot(TM) Server VM (build 1.5.0_05-b05, mixed mode)
Start script content:
bash-2.05$ more merchantInfoUpdate.sh LIB=lib CLASSPATH="." for i in `find $LIB -name *.jar`; do CLASSPATH="$CLASSPATH:$i"; done; export CLASSPATH CLASSPATH=$CLASSPATH:resources/properties java $* -cp $CLASSPATH com.company.ingestion.updater.ListingsManager
I made sure it is actually the jar I'm building which is causing the problem, leaving it alone in the app classpath, and still I get the same error.
Any ideas?
Thanks