Dave
Dave

Reputation: 141

add maven dependency with target java build of 1.6 or multiple

I just want to state this as simple as possible,

I am using RestExpress in my application now, but I am having a big problem with running this into my server.

The problem is that my server runs on OPenJDK 6, but the class build of maven-dependency of RestExpress is 1.7. Is it possible to build the source files as java1.6 or is it possible to have 1.6 and 1.7 build same time?

UPDATE: Im still new to maven dependency build. Im so frustrated right now. its been 3 days

JRE not compatible with project .class file compatibility: 1.7 this is my pressing issue when running the code using 1.6

my pom.xml

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

seems like i cant post an image , i need to get at least 10 rep, uploading fail.

After setting up compiler and run it as java 1.6

java.lang.UnsupportedClassVersionError: org/restexpress/serialization/SerializationProvider : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main" 

thanks

Upvotes: 0

Views: 1443

Answers (1)

austin.s
austin.s

Reputation: 178

try compile RestExpress in jdk1.6,

modify the pom.xml in that project

...
<plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-compiler-plugin</artifactId>
       <version>3.0</version>
       <configuration>
           <source>1.6</source>
           <target>1.6</target>
       </configuration>
</plugin>
...

Upvotes: 1

Related Questions