I am trying to create a simple ArcObjects console app however when trying to initialize the ArcGIS licenses I always get the following error. Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class fileThe error is encountered on the following line of code ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeEngine);I am using ArcObjects 9.3.1 and JRE 1.5.0 Update 10 I can successfully run the Scenario.Utility Object project located in the ArcGIS\java\samples\engine\ folder without error. This uses the exact same method to initialize the arcGIS license. I can also run my custom code if I put the class within the sample project. I have gone through the differences within the two projects and cannot find any differences between the Build Path or Complier.Any help would be appreciated. -Ben de GrootBelow is a full code of the .java fileimport java.io.IOException;
import java.net.UnknownHostException;
import com.esri.arcgis.datasourcesGDB.FileGDBWorkspaceFactory;
import com.esri.arcgis.geodatabase.IWorkspaceFactory;
import com.esri.arcgis.geodatabase.Workspace;
import com.esri.arcgis.interop.AutomationException;
import com.esri.arcgis.system.EngineInitializer;
public class testCreateMap {
public static void main(String[] args) {
System.out.println("Start Create Map"); // Display the string.
IWorkspaceFactory workspaceFactory = null;
Workspace workspace = null;
try {
//Step 1: Initialize the Java Componet Object Model (COM) Interop.
EngineInitializer.initializeEngine();
//Step 2: Initialize an ArcGIS license.
//AoInitialize aoInit = new AoInitialize();
//initializeArcGISLicenses(aoInit);
initializeArcGISLicenses();
//BD TODO the feature set will need to be passed in
workspaceFactory = new FileGDBWorkspaceFactory();
workspace = (Workspace) workspaceFactory.openFromFile("C:\\arcgisserver\\arcgisinput\\data\\NAISMA_scratch.gdb", 0);
System.out.println("End Create Map"); // Display the string.
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (AutomationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
static void initializeArcGISLicenses() {
try {
com.esri.arcgis.system.AoInitialize ao = new com.esri.arcgis.system.AoInitialize();
if (ao.isProductCodeAvailable(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeEngine) == com.esri.arcgis.system.esriLicenseStatus.esriLicenseAvailable)
ao.initialize(com.esri.arcgis.system.esriLicenseProductCode.esriLicenseProductCodeEngine);
} catch (Exception e) {
e.printStackTrace();
}
}
}