05-30-2022 04:10 PM
Hi,
Is Java 11 supported for NSO package development? If so, from what NSO version?
Thanks,
Gabriel
Solved! Go to Solution.
06-21-2022 07:58 AM
The min requirements is Java 8 for the JRE, which means that Java 11 (>8) is supported.
Source: https://developer.cisco.com/docs/nso/guides/#!introduction/prerequisites
Not sure "since when" but you can check in your version installation guide to validate.
Another question is "which is the Java API version that packages get compiled?" by default, the skeleton pushes today for Java8. However, you can manipulate this setting in the build.xml file in your package:
<property name="ncs_java_source_ver" value="1.8"/> <property name="ncs_java_target_ver" value="1.8"/>
Example: In packages/l3vpn/src/java:
rogaglia@ROGAGLIA-M-V7LZ java % more build.xml <project name="package" basedir="." default="all"> <property environment="env"/> <property name="build.dir" value="build"/> <property name="classes.dir" value="${build.dir}/classes"/> <property name="src.dir" value="src"/> <property name="rsc.dir" value="src/resources"/> <property name="sharedjar.dir" value="../../shared-jar"/> <property name="privatejar.dir" value="../../private-jar"/> <property name="doc.dir" value="${build.dir}/javadoc"/> <property name="ncs.dir" value="${env.NCS_DIR}/java/jar"/> <property name="ncs.topdir" value="${env.NCS_DIR}"/> <property name="package" value="l3vpn"/> <!-- Retrieving compilation compability parameters from NCS Remove the following row if this is not desired --> <property file="${env.NCS_DIR}/etc/ncs/java.properties" /> <!-- Set defaults if not set, if the above directive is removed or the property file is missing these values will be used --> <property name="ncs_java_source_ver" value="1.8"/> <property name="ncs_java_target_ver" value="1.8"/> <path id="core-libs"> <fileset dir="${ncs.dir}"> <include name="*.jar"/> </fileset> </path> <target name="all" depends="package" /> <target name="package" depends="compile"> <jar destfile="${sharedjar.dir}/${package}-ns.jar" basedir="${classes.dir}" includes="**/namespaces/*.class"/> <jar destfile="${privatejar.dir}/${package}.jar" basedir="${classes.dir}" excludes="**/namespaces/*.class" includes="**/*.class"/> <jar update="true" destfile="${privatejar.dir}/${package}.jar" basedir="../.." includes="package-meta-data.xml"/> </target> <target name="clean"> <delete dir="${build.dir}"/> <delete file="${sharedjar.dir}/${package}-ns.jar"/> <delete file="${privatejar.dir}/${package}.jar"/> </target> <target name="compile"> <mkdir dir="${classes.dir}"/> <javac srcdir="${src.dir}" destdir="${classes.dir}" source="${ncs_java_source_ver}" target="${ncs_java_target_ver}" debug="on" includeantruntime="false" rogaglia@ROGAGLIA-M-V7LZ java %
Note: you can have as target API Java8 but run it in Java11. It is all about getting into Java non-backward compatible APIs.
06-21-2022 07:58 AM
The min requirements is Java 8 for the JRE, which means that Java 11 (>8) is supported.
Source: https://developer.cisco.com/docs/nso/guides/#!introduction/prerequisites
Not sure "since when" but you can check in your version installation guide to validate.
Another question is "which is the Java API version that packages get compiled?" by default, the skeleton pushes today for Java8. However, you can manipulate this setting in the build.xml file in your package:
<property name="ncs_java_source_ver" value="1.8"/> <property name="ncs_java_target_ver" value="1.8"/>
Example: In packages/l3vpn/src/java:
rogaglia@ROGAGLIA-M-V7LZ java % more build.xml <project name="package" basedir="." default="all"> <property environment="env"/> <property name="build.dir" value="build"/> <property name="classes.dir" value="${build.dir}/classes"/> <property name="src.dir" value="src"/> <property name="rsc.dir" value="src/resources"/> <property name="sharedjar.dir" value="../../shared-jar"/> <property name="privatejar.dir" value="../../private-jar"/> <property name="doc.dir" value="${build.dir}/javadoc"/> <property name="ncs.dir" value="${env.NCS_DIR}/java/jar"/> <property name="ncs.topdir" value="${env.NCS_DIR}"/> <property name="package" value="l3vpn"/> <!-- Retrieving compilation compability parameters from NCS Remove the following row if this is not desired --> <property file="${env.NCS_DIR}/etc/ncs/java.properties" /> <!-- Set defaults if not set, if the above directive is removed or the property file is missing these values will be used --> <property name="ncs_java_source_ver" value="1.8"/> <property name="ncs_java_target_ver" value="1.8"/> <path id="core-libs"> <fileset dir="${ncs.dir}"> <include name="*.jar"/> </fileset> </path> <target name="all" depends="package" /> <target name="package" depends="compile"> <jar destfile="${sharedjar.dir}/${package}-ns.jar" basedir="${classes.dir}" includes="**/namespaces/*.class"/> <jar destfile="${privatejar.dir}/${package}.jar" basedir="${classes.dir}" excludes="**/namespaces/*.class" includes="**/*.class"/> <jar update="true" destfile="${privatejar.dir}/${package}.jar" basedir="../.." includes="package-meta-data.xml"/> </target> <target name="clean"> <delete dir="${build.dir}"/> <delete file="${sharedjar.dir}/${package}-ns.jar"/> <delete file="${privatejar.dir}/${package}.jar"/> </target> <target name="compile"> <mkdir dir="${classes.dir}"/> <javac srcdir="${src.dir}" destdir="${classes.dir}" source="${ncs_java_source_ver}" target="${ncs_java_target_ver}" debug="on" includeantruntime="false" rogaglia@ROGAGLIA-M-V7LZ java %
Note: you can have as target API Java8 but run it in Java11. It is all about getting into Java non-backward compatible APIs.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide