1
votes

The Docs of Azure Service Bus have in example picture:

https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-java-how-to-use-queues#configure-your-application-to-use-service-bus

that it uses java 8. Also code samples use Java 8 syntax and functions. I have an environment of java 7 and I am unable to get it work supposedly because java is too old.

Does anyone know a working combination of the Azure Service Bus with Java 7? I would need either the version that works for sure or answer that no version does so.

I test with newest 1.2 version available of Azure Service Bus.

1

1 Answers

1
votes

I checked the maven repository list of Azure ServiceBus, these versions after 0.9.8 are all built by Java 8 via check the pom.xml file, the version 0.9.8 is built by Java 1.6. Therefore, there is not any released jar files compiled by Java 7 or other ealier Java version for the latest version 1.x.x.

A workaround way for yours is manually to download the source codes of Azure ServiceBus from GitHub repo to compile it in maven by yourself. You can use JDK 7 to do it, even use JDK 8. The only changes you need is use 1.7 instead of 1.8 for the configuration of maven-compiler-plugin in pom.xml, such as below.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.5</version>
    <configuration>
        <source>1.7</source>  <!-- 1.8 -->
        <target>1.7</target>  <!-- 1.8 -->
        <optimize>true</optimize>
        <showDeprecation>true</showDeprecation>
        <showWarnings>true</showWarnings>
    </configuration>
</plugin>

Note: If using JDK 8 to do this above for compiling with the javac parameter -target 1.7 -source 1.7, you must make sure there is not any code of using Java 8 features which will cause compiler error, such as error: lambda expressions are not supported in -source 1.7 for JDK 8. However, I roughly checked its source codes that there seems not to be. For more details about -target or -source for Javac 8, please see https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html.