Showing posts with label ArcObjects. Show all posts
Showing posts with label ArcObjects. Show all posts

Sunday, February 22, 2015

Open Shape File Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Open Shape File




 //Open Shape file  
      public void openShapefile(String workspacePath, String shapefileName) {  
           /*  
            * In this code, the file extension, .shp is not used when specifying  
            * the name of the shapefile to be opened.  
            */  
           try {  
                ShapefileWorkspaceFactory wsf = new ShapefileWorkspaceFactory();  
                Workspace work = new Workspace(wsf.openFromFile(workspacePath, 0));  
                IFeatureClass featureClass = work.openFeatureClass(shapefileName);  
                FeatureLayer layer = new FeatureLayer();  
                layer.setFeatureClassByRef(featureClass);  
                layer.setName(featureClass.getAliasName());  
                mxDoc.getFocusMap().addLayer(layer);  
           } catch (Exception e) {  
                e.printStackTrace();  
           }  
      }  


This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Open Feature Class Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Print Field Information of Feature Class


 // Opens feature Class from database  
      public void openfeatureclass(String workspacePath, String fcName){  
        try{  
                mxDoc = (IMxDocument) app.getDocument();  
                FileGDBWorkspaceFactory wsf = new FileGDBWorkspaceFactory();  
                Workspace work = new Workspace(wsf.openFromFile(workspacePath, 0));  
          IFeatureClass featureClass = work.openFeatureClass(fcName);  
          FeatureLayer layer = new FeatureLayer();  
          layer.setFeatureClassByRef(featureClass);  
          layer.setName(featureClass.getAliasName());  
          mxDoc.getFocusMap().addLayer(layer);  
        }  
        catch (Exception e){  
          e.printStackTrace();  
        }  
      }  


This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Print Field Information of Feature Class Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Print Field Information of Feature Class


 static void displayFields(IFeatureClass featureClass) throws Exception {  
           IFields fields = featureClass.getFields();  
           IField field;  
           for (int i = 0; i < fields.getFieldCount(); i++) {  
                field = fields.getField(i);  
                displayFieldInformation(field);  
           }  
      }  
      static void displayFieldInformation(IField field) throws Exception {  
           // Physical name.  
           System.out.println("Name : " + field.getName());  
           // Alias name.  
           System.out.println("Alias Name : " + field.getAliasName());  
           // Field type.  
           String value = "";  
           switch (field.getType()) {  
           case esriFieldType.esriFieldTypeSmallInteger:  
                value = "Small Integer";  
                break;  
           case esriFieldType.esriFieldTypeInteger:  
                value = "Long Integer";  
                break;  
           case esriFieldType.esriFieldTypeSingle:  
                value = "Single-precision floating-point number";  
                break;  
           case esriFieldType.esriFieldTypeDouble:  
                value = "Double-precision floating-point number";  
                break;  
           case esriFieldType.esriFieldTypeString:  
                value = "Character string";  
                break;  
           case esriFieldType.esriFieldTypeDate:  
                value = "Date";  
                break;  
           case esriFieldType.esriFieldTypeOID:  
                value = "Long Integer representing an object identifier";  
                break;  
           case esriFieldType.esriFieldTypeGeometry:  
                value = "Geometry";  
                break;  
           case esriFieldType.esriFieldTypeBlob:  
                value = "Binary Large Object, Blob Storage";  
                break;  
           case esriFieldType.esriFieldTypeRaster:  
                value = "Raster";  
                break;  
           case esriFieldType.esriFieldTypeGUID:  
                value = "Globally Unique Identifier";  
                break;  
           case esriFieldType.esriFieldTypeGlobalID:  
                value = "ESRI Global ID";  
                break;  
           case esriFieldType.esriFieldTypeXML:  
                value = "XML Document";  
                break;  
           }  
           System.out.println("Type : " + value);  
           // Field length—this is only valid for fields of Type  
           // esriFieldTypeString.  
           System.out.println("Length : " + field.getLength());  
           // Field precision.  
           System.out.println("Precision : " + field.getPrecision());  
           // Field scale.  
           System.out.println("Scale : " + field.getScale());  
           // Editable.  
           System.out.println("Editable : " + field.isEditable());  
           // Default value.  
           System.out.println("Default Value : " + field.getDefaultValue());  
           IGeometryDef geomDef = field.getGeometryDef();  
           if (geomDef != null) {  
                System.out.println("GeometryDef Properties");  
                System.out.println("AvgNumPoints : " + geomDef.getAvgNumPoints());  
                System.out.println("Grid Count : " + geomDef.getGridCount());  
                for (int i = 0; i < geomDef.getGridCount(); i++) {  
                     System.out.println("Grid Size[" + i + "]="  
                               + geomDef.getGridSize(i));  
                }  
                System.out.println("Has Measures : " + geomDef.isHasM());  
                System.out.println("Has Z : " + geomDef.isHasZ());  
                System.out.println("Spatial Ref : "  
                          + geomDef.getSpatialReference().getName());  
           }  
           System.out.println("");  
      }  


This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Print values of attributes in Feature Class Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Print values of attributes in Feature Class


      //Access values of attributes in fields  
      static void printDistinctFieldValueNames(IFeatureClass featureClass, String Condition)  
                throws Exception {  
           QueryFilter queryFilter = new QueryFilter();  
           #queryFilter.setWhereClause("Name='Ahmed'");  
           queryFilter.setWhereClause(Condition);  
           IFeatureCursor featureCursor = featureClass.search(queryFilter, true);  
           IFields fields = featureCursor.getFields();  
           int fieldCount = fields.getFieldCount();  
           for (int i = 0; i < fieldCount; i++) {  
                IField fieldI = fields.getField(i);  
                String fieldName = fieldI.getName();  
                System.out.print(fieldName + "\t");  
           }  
           System.out.println();  
           IFeature feature = featureCursor.nextFeature();  
           while (feature != null) {  
                StringBuffer row = new StringBuffer();  
                for (int i = 0; i < fieldCount; i++) {  
                     int fieldType = feature.getFields().getField(i).getType();  
                     switch (fieldType) {  
                     case esriFieldType.esriFieldTypeDate:  
                     case esriFieldType.esriFieldTypeDouble:  
                     case esriFieldType.esriFieldTypeGlobalID:  
                     case esriFieldType.esriFieldTypeGUID:  
                     case esriFieldType.esriFieldTypeInteger:  
                     case esriFieldType.esriFieldTypeOID:  
                     case esriFieldType.esriFieldTypeSingle:  
                     case esriFieldType.esriFieldTypeSmallInteger:  
                     case esriFieldType.esriFieldTypeString:  
                          row.append(feature.getValue(i) + "\t");  
                          break;  
                     case esriFieldType.esriFieldTypeBlob:  
                          row.append("(blob)" + "\t");  
                          break;  
                     case esriFieldType.esriFieldTypeGeometry:  
                          row.append("(geometry)" + "\t");  
                          break;  
                     case esriFieldType.esriFieldTypeRaster:  
                          row.append("(raster)" + "\t");  
                          break;  
                     }  
                }  
                if (row.length() > 0) {  
                     System.out.println(row);  
                }  
                feature = featureCursor.nextFeature();  
           }  
      }  


This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Print values of selected features in Feature Class Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Print values of selected features in Feature Class


 // display values of selected features in shape file (file system)  
      static void getselectedfeaturesvalueShp(IApplication app) {  
           IMxDocument mxDoc;  
           try {  
                mxDoc = (IMxDocument) app.getDocument();  
                int count = mxDoc.getActiveView().getFocusMap().getLayerCount();  
                for (int layerno = 0; layerno < count; layerno++) {  
                     if (mxDoc.getActiveView().getFocusMap().getLayer(layerno).isVisible()) {  
                          System.out.println("Layer " + layerno + " visible");  
                     }  
                }  
                Map map = (Map) mxDoc.getMaps().getItem(0);  
                MapSelection mapSelection = new MapSelection(map.getFeatureSelection());  
                mapSelection.reset();  
                IFeature feature = mapSelection.next();  
                while (feature != null) {  
                     int oid = (int) feature.getOID();  
                     System.out.println("OID of Selected feature = " + oid);  
                     int fieldcount = feature.getTable().getRow(oid).getFields().getFieldCount();  
                     System.out.println(" fieldcount = " + fieldcount);  
                     for (int q=0; q<fieldcount; q++){  
                          System.out.println("Field Name = "+ feature.getTable().getFields().getField(q).getName());  
                          System.out.println("Field Value = "+ feature.getTable().getRow(oid).getValue(q));  
                     }  
                     feature = mapSelection.next();       
                     System.out.println("***");                      
                }  
           } catch (AutomationException e) {  
                // TODO Auto-generated catch block  
                e.printStackTrace();  
           } catch (IOException e) {  
                // TODO Auto-generated catch block  
                e.printStackTrace();  
           }  
      }  



This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Print Field Names and Field Properties of Feature Class Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Print Field Names of Shapefile, Feature Class


 // display field properties of each field in detail  
 static void displayFieldProperties(IFeatureClass featureClass)  
           throws Exception {  
      // Get the fields collection for the feature class.  
      IFields fields = featureClass.getFields();  
      IField field = null;  
      for (int i = 0; i < fields.getFieldCount(); i++) {  
           field = fields.getField(i);  
           // Get the standard field properties.  
           System.out.println("Name: " + field.getName());  
           System.out.println("Alias: " + field.getAliasName());  
           System.out.println("Type: " + field.getType());  
           System.out.println("VarType: " + field.getVarType());  
           System.out.println("Default Value: " + field.getDefaultValue());  
           System.out.println("Length: " + field.getLength());  
           System.out.println("Precision: " + field.getPrecision());  
           System.out.println("Scale: " + field.getScale());  
           System.out.println("Is Editable: " + field.isEditable());  
           System.out.println("Is Nullable: " + field.isNullable());  
           System.out.println("Is Required: " + field.isRequired());  
           // Check if the field is the shape field.  
           if (field.getType() == esriFieldType.esriFieldTypeGeometry) {  
                IGeometryDef geometryDef = field.getGeometryDef();  
                System.out.println("Geometry Type: "  
                          + geometryDef.getGeometryType());  
                System.out.println("Has M Values: " + geometryDef.isHasM());  
                System.out.println("Has Z Values: " + geometryDef.isHasZ());  
           }  
           // Insert an empty line for readability.  
           System.out.println();  
      }  
 }  





This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Print Field Names of Shapefile Feature Class Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Print Field Names of Shapefile, Feature Class

 // printDistinctFieldAliasNames work with shape file  
 static void printDistinctFieldAliasNames(IFeatureClass featureClass)  
           throws Exception {  
      // get the Fields collection from the feature class  
      IFields fields = featureClass.getFields();  
      IField field;  
      // on a zero based index iterate through the fields in the collection  
      for (int i = 0; i < fields.getFieldCount(); i++) {  
           // get the field at the given index  
           field = fields.getField(i);  
           System.out.println("field.getName() = " + field.getName());  
           if (!field.getName().equals(field.getAliasName())) {  
                System.out  
                          .println(field.getName() + ":" + field.getAliasName());  
           }  
      }  
      IFeatureCursor featureCursor = featureClass.search(null, true);  
      IFields fields1 = featureCursor.getFields();  
      System.out.println("fields1 = " + fields1);  
      int fieldCount = fields1.getFieldCount();  
      System.out.println("fieldCount = " + fieldCount);  
      for (int i = 0; i < fieldCount; i++) {  
           IField fieldI = fields1.getField(i);  
           String fieldName = fieldI.getName();  
           System.out.print(fieldName + "\t");  
      }  
      System.out.println();  
 }  



This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Load Pre Defined Projections Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Load Pre-Defined Projections


 // print pre defined projections in arcobjects  
 static void printPreDefinedProjections() throws Exception {  
      ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironment();  
      ISet projectionSet = spatialReferenceFactory  
                .createPredefinedProjections();  
      System.out.println("Number of predefined Projections = "  
                + projectionSet.getCount());  
      projectionSet.reset();  
      for (int i = 0; i < projectionSet.getCount(); i++) {  
           IProjection projection = (IProjection) projectionSet.next();  
           System.out.println(projection.getName());  
      }  
 }  





This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Load Projected Coordinate System from file Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Load Geographic Coordinate System from file



 // load Projected projected system from file  
 static IProjectedCoordinateSystem loadProjectedCoordinateSystem()  
           throws Exception {  
      ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironment();  
      IProjectedCoordinateSystem projectedCoordinateSystem = (IProjectedCoordinateSystem) spatialReferenceFactory  
                .createESRISpatialReferenceFromPRJFile("D:/work/WGS1984UTMZone43N.prj");  
      return projectedCoordinateSystem;  
 }  




This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Load Geographic Coordinate System from file Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Load Geographic Coordinate System from file


 // load Geographic cordinate system from file  
 static IGeographicCoordinateSystem loadGeographicCoordinateSystem()  
           throws Exception {  
      ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironment();  
      IGeographicCoordinateSystem geographicCoordinateSystem = (IGeographicCoordinateSystem) spatialReferenceFactory  
                .createESRISpatialReferenceFromPRJFile("D:/work/WGS1984.prj");  
      return geographicCoordinateSystem;  
 }  





This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Create Fields Collection Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Create Fields Collection



 // create field collection for table  
 public IFields createFieldsCollectionForTable() throws Exception {  
      // Create a new fields collection.  
      IFields fields = new Fields();  
      // Cast for IFieldsEdit to modify the properties of the fields  
      // collection.  
      IFieldsEdit fieldsEdit = (IFieldsEdit) fields;  
      // Set the FieldCount to the total number of fields to be created.  
      fieldsEdit.setFieldCount(2);  
      // Create the ObjectID field.  
      IField fieldUserDefined = new Field();  
      // Cast for IFieldEdit to modify the properties of the new field.  
      IFieldEdit fieldEdit = (IFieldEdit) fieldUserDefined;  
      fieldEdit.setAliasName("FID");  
      fieldEdit.setName("ObjectID");  
      fieldEdit.setType(esriFieldType.esriFieldTypeOID);  
      // Add the new field to the fields collection.  
      fieldsEdit.setFieldByRef(0, fieldUserDefined);  
      // Create the text field.  
      fieldUserDefined = new Field();  
      fieldEdit = (IFieldEdit) fieldUserDefined;  
      fieldEdit.setLength(30); // Only string fields require that you set the  
                                         // length.  
      fieldEdit.setName("Owner");  
      fieldEdit.setType(esriFieldType.esriFieldTypeString);  
      // Add the new field to the fields collection.  
      fieldsEdit.setFieldByRef(1, fieldUserDefined);  
      return fields;  
 }  




This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Saturday, February 21, 2015

Create Feature Class Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Create Feature Class


 // Create Feature Class  
 static IFeatureClass createFeatureClass(IFeatureDataset featureDataset,  
           String nameOfFeatureClass) throws Exception {  
      // This function creates a new feature class in a supplied feature  
      // dataset by creating all fields from scratch. IFeatureClassDescription (or  
      // IObjectClassDescription if the table is  
      // created at the workspace level) can be used to get the required  
      // fields and are used to  
      // get the InstanceClassID and ExtensionClassID.  
      // Create new fields collection with the number of fields you plan to  
      // add. Must add at least two fields  
      // for a feature class: Object ID and Shape field.  
      IFields fields = new Fields();  
      IFieldsEdit fieldsEdit = (IFieldsEdit) fields;  
      fieldsEdit.setFieldCount(3);  
      // Create Object ID field.  
      IField fieldUserDefined = new Field();  
      IFieldEdit fieldEdit = (IFieldEdit) fieldUserDefined;  
      fieldEdit.setName("OBJECTID");  
      fieldEdit.setAliasName("OBJECT ID");  
      fieldEdit.setType(esriFieldType.esriFieldTypeOID);  
      fieldsEdit.setFieldByRef(0, fieldUserDefined);  
      // Create Shape field.  
      fieldUserDefined = new Field();  
      fieldEdit = (IFieldEdit) fieldUserDefined;  
      // Set up geometry definition for the Shape field.  
      // You do not have to set the spatial reference, as it is inherited from  
      // the feature dataset.  
      IGeometryDef geometryDef = new GeometryDef();  
      IGeometryDefEdit geometryDefEdit = (IGeometryDefEdit) geometryDef;  
      geometryDefEdit.setGeometryType(esriGeometryType.esriGeometryPolyline);  
      // By setting the grid size to 0, you are allowing ArcGIS to determine  
      // the appropriate grid sizes for the feature class.  
      // If in a personal geodatabase, the grid size is 1,000. If in a file or  
      // ArcSDE geodatabase, the grid size  
      // is based on the initial loading or inserting of features.  
      geometryDefEdit.setGridCount(1);  
      geometryDefEdit.setGridSize(0, 0);  
      geometryDefEdit.setHasM(false);  
      geometryDefEdit.setHasZ(false);  
      // Set standard field properties.  
      fieldEdit.setName("SHAPE");  
      fieldEdit.setType(esriFieldType.esriFieldTypeGeometry);  
      fieldEdit.setGeometryDefByRef(geometryDef);  
      fieldEdit.setIsNullable(true);  
      fieldEdit.setRequired(true);  
      fieldsEdit.setFieldByRef(1, fieldUserDefined);  
      // Create a field of type double to hold some information for the  
      // features.  
      fieldUserDefined = new Field();  
      fieldEdit = (IFieldEdit) fieldUserDefined;  
      fieldEdit.setName("Avg_income");  
      fieldEdit.setAliasName("Average income for 1999-2000");  
      fieldEdit.setEditable(true);  
      fieldEdit.setIsNullable(false);  
      fieldEdit.setPrecision(2);  
      fieldEdit.setScale(5);  
      fieldEdit.setType(esriFieldType.esriFieldTypeDouble);  
      fieldsEdit.setFieldByRef(2, fieldUserDefined);  
      // Create a feature class description object to use for specifying the  
      // CLSID and EXTCLSID.  
      IFeatureClassDescription fcDesc = new FeatureClassDescription();  
      IObjectClassDescription ocDesc = (IObjectClassDescription) fcDesc;  
      return featureDataset.createFeatureClass(nameOfFeatureClass, fields,  
                ocDesc.getInstanceCLSID(), ocDesc.getClassExtensionCLSID(),  
                esriFeatureType.esriFTSimple, "SHAPE", "");  
 }  



This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Create Feature Data Set Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Create Feature Dataset



 // Create feature dataset  
 static IFeatureDataset createFeatureDataset(IWorkspace workspace,  
           String fdsName, ISpatialReference fdsSR) throws Exception {  
      IFeatureWorkspace featureWorkspace = new IFeatureWorkspaceProxy(  
                workspace);  
      return featureWorkspace.createFeatureDataset(fdsName, fdsSR);  
 }  




This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Create Workspace Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Create Workspace


 // Create Workspace  
 IWorkspace openFromString_fGDB_Workspace(String connectionString)  
           throws Exception {  
      IWorkspaceFactory2 workspaceFactory = new FileGDBWorkspaceFactory();  
      return workspaceFactory.openFromString(connectionString, 0);  
 }  


This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Create Database Esri ArcObjects Snippets - Series

Esri ArcObjects Snippets - Series

Create Database



 // Create Database
 public void createdatabase() {  
      String file = "D:\\work\\PAKdatabase";  
      // ***Create Database  
      try {  
           // Create a FileGDB workspace factory  
           IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactory();  
           // Create a new File geodatabase  
           IWorkspaceName workspaceName = workspaceFactory  
                     .create("D:\\work\\", "MyFGDB.gdb", null, 0);  
           System.out.println("workspaceName = " + workspaceName.toString());  
           // Cast for IName  
           IName name = (IName) workspaceName;  
           System.out.println("name = " + name.toString());  
           // Open a reference to the access workspace through the name object  
           IWorkspace workspace = new IWorkspaceProxy(name.open());  
      } catch (Exception e) {  
           e.printStackTrace();  
      }  
 }  

This code has been made using ESRI Resources and other Help Content and is provided here just for educational purpose.

Sunday, October 26, 2014

Configure Eclipse for Arcobjects SDK for Java

Configure Eclipse for Arcobjects SDK for Java

This post will guide you on how to instal and configure arcobjects sdk for java.

After installing you’ll get the folder of DeveloperKit10.2 in C:\Program Files (x86)\ArcGIS\DeveloperKit10.2 or whatever your installed directory is.
  
Now install Eclipse ide after Eclipse is installed we have to import the arcobjects library or install it into eclipse.
Open Eclipse
Go to Help à Install New Software à Click on the Add button



In Name Enter Arcobjectslibrary à click on Local button and select the path
C:\Program Files (x86)\ArcGIS\DeveloperKit10.2\java\tools\eclipse_plugin\arcgis_update_site\arcobjects
Or whatever your installed directory of ArcGIS is.



And click ok. It will take some time and might give you error that arc gis palette cant be installed So for that you have to install swing in Eclipse first before installing arcobjects.
(Installing Swing and other components is easy Just open eclipse à Help à Instal New Software à click on the drop down and select the site of your eclipse version as in my case its kepler)




Under General Select Swing designer and AWT designer and click install. Now it’ll take some time to install.
After its installed try again installing arcobjects and this time it’ll get installed. How ever if the Pallete does not gets installed then no worries J
Okay now Lets get started

For ArcGIS 10.0 and older versions I’ll recommend you to use 32 bit eclipse and 32 bit Java but for ArcGIS 10.1 or newer it don’t really matter. I am using 10.2 ArcGIS and for that I am using 64 bit eclipse and for Java I am using 64 bit but for eclipse in general but for arc objects you require 32 bit I’ll tell you how you can manage this.
We’ll start by running a small sample to show you how to run it and also to help you cater the basic error which might occur. After that I am going to show you about how to make a basic add in (toolbar button dockable window etc) in ArcObjects for ArcGIS.

ArcObjects Development, Developing Stand Alone GIS Desktop Applications and Developing Addins for ArcGIS Desktop


Develop Addin for ArcGIS Part 1


Develop Addin for ArcGIS Part 2

Develop Addin for ArcGIS Part 2

Develop Addin for ArcGIS Part 2

To see the part 1 click here

In this post we'll develop Add in for ArcGIS.
 We have configured the Eclipse project for Addin Development using Arcobjects and also configured the Java for it.
To configure Project for ArcObject see this post.

We have the project setup for this. you can see the config.xml file in its addin view (we'll talk about the views later). This view helps alot and makes sure the consistency and their are no errors in config file. Through this we can add different buttons, tools, meus, system tools, dockable window, palette etc and also can organize them.
Click on the source tab at the bottom of config.xml and you can see the xml source code.
Click back to addin view.
Add the details of project Name company etc etc What they are ? you can find help regarding this in esri resource help.

http://resources.arcgis.com/en/help/arcobjects-java/concepts/engine/

Click on add button and Add the toolbar.
Give name and id. This id will be used in our java classes later.

Add some System tools e.g zoomin, pan etc.

After Adding Click on Toolbars and you'll see that it refreshes it self and you'll see the added system tools are shown under your toolbar.
Now we'll add custom functionality. Click on Add and select button. A new button will be created. you have to add this button to your toolbar explicitly by again selecting the toolbar and adding the new button to right pane.

Fill in the details 

Click on Class button and press finish.

Class will be formed

Enter the following code.

Add the button to toolbar.

You can see the button added to toolbar

On Config.xml press export to add addin to ArcGIS. Now there are different methods to deploy your addin. I will follow the simple approach of direct deploying. 
You can see the list of deploying options and details here
http://resources.arcgis.com/en/help/arcobjects-java/concepts/engine/#/How_to_deploy_your_add_in/0001000006sp000000/

You can give the path of C:\Users\Blabla\Documents\ArcGIS\AddIns\Desktop10.2 and press finish. A warning may appear press ok.

Open ArcMap and click on customize and then click on addins and see the installed addin.
Again click on customize and the click on toolbars and add you toolbar.
You can see our toolbar.

Click on the button and see the Hello World ;)



Develop Addin for ArcGIS Part 1

Develop Addin for ArcGIS Part 1

In this post we'll develop a basic addin for ArcGIS using ArcObjects SDK for Java.

Open Eclipse and Create new project 
File -> New -> Other


Then Select Esri Templates -> ArcGIS Extensions -> Desktop -> ArcMap Add In Project

Then On New Addin Project window  and click on Configure JRE (We are going to add ArcObjects compatible JRE to eclipse it comes installed with ArcGIS desktop after that we'll set the execution environment)

Click on Add 

Select Standard VM
Click Next
Click on Directory and enter the name and following path as shown in figure
Click finish
Again click on configure JRE
Select installed JREs and click on execution Environments
Select Java SE 1.6 and Select the previously added JRE (Java ArcGIS)
Click Ok and Click Next
Click on libraries tab
Click Add libraries
Select ArcObjects Libraries 
(for adding Arcobjects library to eclipse see this tutorial)
Click finish
You can see the following on your screen. Everything is configured.

For next part see the next tutorial here

ArcObjects Development, Developing Stand Alone GIS Desktop Applications and Developing Addins for ArcGIS Desktop

ArcObjects Development, Developing Stand Alone GIS Desktop Applications and Developing Addins for ArcGIS

This post is going to discuss what things are required for Developing Stand Alone GIS desktop Applications or for developing Addins (plugins) for ArcGIS.

We'll be using ArcObjects SDK for Java. Esri also facilitates its user by giving a complete detailed resource for SDK. here are some of the important links

http://resources.arcgis.com/en/help/arcobjects-java/concepts/engine/

Why i am writing this post is because of the reason that for beginners this resource will not be of much help. This blog aims to help developers who are in their learning phase. So I'' tell you the basic start up tips for this arcobjects development.

Pre-requisites required :
Basic Understanding of Java
Eclipse IDE configured to be used for arcobject developments
To configure eclipse see this post

Outline:
1. How to check errors, how to enable console of ArcGIS, how to log errors.
3. Develop Stand alone GIS desktop application.
4. Coming Soon