0

I'm trying to compile a Java source code with javac in a Linux terminal allocated in a machine that I have not permission to modify its Java version. Now it has 1.7.0_111 version, and the result I obtained is:

enter image description here

How can I manage to compile my code? Is there any manner to compile my source code using compatibility mode?

Thank you.

giorgioW
  • 331
  • 5
  • 20
  • 1
    Please copy and paste all the text from the terminal into the question - only the text is relevant, and it's *much* easier to see text when it's posted *as* text. – Jon Skeet May 05 '17 at 19:03
  • It seems you're trying to make an older version of `java` to run a program compiled by a much newer `javac` compiler. If you have the source, you can compile it with the `--source` and `--target` parameters to comply with the version you will run it. – Edwin Dalorzo May 05 '17 at 19:05

1 Answers1

2

The code is actually compiled with JDK 8 and you want to execute it with Java 7.
You cannot.

If you code doesn't use specificities from Java 8, you could compile it with as Java target, the Java 7 version.

For example :

javac -source 1.7 -target 1.7  ...

Otherwise you are stuck.

davidxxx
  • 125,838
  • 23
  • 214
  • 215