1

I am working on existing webservice code which was built on axis 1.4 and java 1.4,now we are upgrading all servers with java version 1.7, We are facing problem with upgrading 1.4 to 1.7(as org.apache.enum depricatedin java 1.5 and above version).

so we are planning to compile the code with java 1.4 and generate war file, deploy that war file in apache tomcat(version 6).

does it impact my webservice?? I feel once the byte code is generated by the compiler it wont depend on java version to run .class file.

please suggest me if I am mistaken anything.

ug_
  • 11,267
  • 2
  • 35
  • 52
user3644696
  • 61
  • 1
  • 2
  • 8
  • 2
    In general it should work, but there's always a possibility that you will hit some incompatibility problem. – Tagir Valeev Jun 23 '15 at 06:59
  • Other then the `enum` I have never experienced JDK wise backward compatibility issue. But as said by @Tagir other libraries might have some dependency issues. – Subir Kumar Sao Jun 23 '15 at 07:03
  • You can cross compile the code : Check This thread : [Link][1] [1]: http://stackoverflow.com/questions/18320587/javac-cross-compilation-with-1-7 – Manish Gupta Jun 23 '15 at 07:03
  • @SubirKumarSao, an example of problem which I actually encountered is new methods in [java.sql.Connection](https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#setSchema%28java.lang.String%29) interface. If you had your own implementation of this interface prior to JDK7, this class will not be loaded correctly after upgrade as implementation of new methods are missing. Chances of such problems are low, but non-zero. – Tagir Valeev Jun 23 '15 at 07:08

1 Answers1

0

Yes. JVM(Java Virtual Machin) would run your class file without any problem.

However if you will try to compile your java code (.java) in 1.7 SDK, it may cause problem as mentioned in comments by experts, above.

Java is a platform independent language.

Once you write a java program (.java), java compiler converts it into byte codes (.class) or you can say machine code of the processor.

Now you can run (in correct term "interpret") this byte code on any machine with JVM. JVM varies from platform to platform (platform dependent).You can consider JVM as processor purely implemented with software.

That's the beauty of java "write once, run anywhere". All you need is correct JVM for your machine.

For further reading...

https://en.wikipedia.org/wiki/Java_virtual_machine

http://docs.oracle.com/cd/E19455-01/806-3461/6jck06gqd/index.html

kingAm
  • 1,755
  • 1
  • 13
  • 23