Following is my code which i am trying
public class SdeOrPgdb {
public SdeOrPgdb(){
}
public static void main(String[] args) {
try{
bootstrapArcobjectsJar();
//Initialize engine console application
EngineInitializer.initializeEngine();
//Initialize ArcGIS license
AoInitialize aoInit = new AoInitialize();
initializeArcGISLicenses(aoInit);
SdeOrPgdb accessFileGDB = new SdeOrPgdb();
accessFileGDB.openFromFile_sde_Workspace();
System.out.println("Done.");
//Ensure any ESRI libraries are unloaded in the correct order
aoInit.shutdown();
}catch(Exception e){
System.out.println("Error: " + e.getMessage());
System.out.println("Sample failed. Exiting...");
e.printStackTrace();
System.exit(-1);
}
}
private static void initializeArcGISLicenses(AoInitialize aoInit) {
try {
if (aoInit.isProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeEngine)
== esriLicenseStatus.esriLicenseAvailable)
aoInit.initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
else if (aoInit.isProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeArcView)
== esriLicenseStatus.esriLicenseAvailable)
aoInit.initialize(esriLicenseProductCode.esriLicenseProductCodeArcView);
else{
System.err.println("Could not initialize an Engine or ArcView license. Exiting application.");
System.exit(-1);
}
} catch (Exception e) {e.printStackTrace();}
}
public static void bootstrapArcobjectsJar(){
//Get the ArcGIS Engine runtime, if it is available
String arcObjectsHome = System.getenv("AGSENGINEJAVA");
//If no runtime is available, exit application gracefully
if (arcObjectsHome == null){
System.err.println(
"You must have the ArcGIS Engine Runtime installed in order to execute this application.");
System.err.println(
"Install the product above, then re-run this application.");
System.err.println("Exiting execution of this application...");
System.exit( - 1);
}
//Obtain the relative path to the arcobjects.jar file
String jarPath = arcObjectsHome + "java" + File.separator + "lib" +
File.separator + "arcobjects.jar";
//Create a new file
File jarFile = new File(jarPath);
//Test for file existence
if (!jarFile.exists()){
System.err.println(
"The arcobjects.jar was not found in the following location: " +
jarFile.getParent());
System.err.println(
"Verify that arcobjects.jar can be located in the specified folder.")
;
System.err.println(
"If not present, try uninstalling your ArcGIS software and reinstalling it.");
System.err.println("Exiting execution of this application...");
System.exit( - 1);
}
//Helps load classes and resources from a search path of URLs
URLClassLoader sysloader = (URLClassLoader)ClassLoader.getSystemClassLoader()
;
Class < URLClassLoader > sysclass = URLClassLoader.class;
try{
Method method = sysclass.getDeclaredMethod("addURL", new Class[]{
URL.class
}
);
method.setAccessible(true);
method.invoke(sysloader, new Object[]{
jarFile.toURI().toURL()
}
);
}
catch (Throwable throwable){
throwable.printStackTrace();
System.err.println("Could not add arcobjects.jar to system classloader");
System.err.println("Exiting execution of this application...");
System.exit( - 1);
}
}
and following is my error stack after running jar file from command promt--java.lang.IllegalArgumentException: URI is not hierarchical at java.io.File.<init>(File.java:392) at com.esri.arcgis.interop.NativeLoader.getArcGISHome(Unknown Source) at com.esri.arcgis.interop.NativeLoader.loadLibrary(Unknown Source) at com.esri.arcgis.system.EngineInitializer.initializeEngine(Unknown Source) at SdeOrPgdb.main(SdeOrPgdb.java:70) at BrowsePath.actionPerformed(BrowsePath.java:317) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6270) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:708) at java.awt.EventQueue$4.run(EventQueue.java:706) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:705) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) Note : "SdeOrPgdb.main(SdeOrPgdb.java:70) " in code is "EngineInitializer.initializeEngine();"