#!/usr/bin/env bash # Compile the given Java file for the different versions of Java # E.g., if you use the ASM Viewer plugin for IntelliJ IDEA, # that plugin can't deal with Java 10. # It can read Java class files for older versions of Java, though. # So, here we compile it for all versions of Java supported by the Java 10 javac compiler. CLASS=$1 VERSIONS=( 6 7 8 9 10 ) for VERSION in "${VERSIONS[@]}" do echo Version $VERSION mkdir -p java$VERSION javac -d java$VERSION --release $VERSION $CLASS done