1

I have to migrate my web app from Java 6 to Java 8. I have made a few code changes and compiled with Java. It was successful and my manifest.mf contains:- Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.6 Created-By: 1.8.0_171-b11 (Oracle Corporation)

But when running the compiled war on a linux virtual box (jre 1.6, tomcat 7.0.29) it does not throw major minor unsupported exception.

Is this normal?

Soham Banerjee
  • 117
  • 1
  • 13

1 Answers1

0

If you have explicit "-source 1.6" and "-target 1.6" parameters passed to javac and you don't use any Java8 feature that requires new bytecode version then compiled code can still be launched on JVM 6.

$ cat Empty.java
class Empty {};
$ javac Empty.java
$ file Empty.class
Empty.class: compiled Java class data, version 52.0 (Java 1.8)
$ javac -target 1.6 -source 1.6 Empty.java
warning: [options] bootstrap class path not set in conjunction with -source     1.6
1 warning
$ file Empty.class
Empty.class: compiled Java class data, version 50.0 (Java 1.6) 

Check if you ant/maven files don't set those parameters.

user158037
  • 2,659
  • 1
  • 24
  • 27