首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

eclipse演练arcobjects示例的时候“AutomationException”咋办

2013-06-19 
eclipse演示arcobjects示例的时候“AutomationException”咋办Exception in thread main java.lang.Runtim

eclipse演示arcobjects示例的时候“AutomationException”咋办

Exception in thread "main" java.lang.RuntimeException: AutomationException: 0x80040112 - 
at com.esri.arcgis.interop.Ocx.<init>(Unknown Source)
at com.esri.arcgis.controls.PageLayoutControl.<init>(Unknown Source)
at com.esri.arcgis.beans.pagelayout.PageLayoutBean.c(Unknown Source)
at com.esri.arcgis.beans.pagelayout.PageLayoutBean.<init>(Unknown Source)
at tryAndTest.MapViewerFrame.<init>(MapViewer.java:32)
at tryAndTest.MapViewer.main(MapViewer.java:69)
Caused by: AutomationException: 0x80040112 - 
... 6 more

代码如下:(省去了import了)


class MapViewerFrame extends JFrame {
PageLayoutBean pageLayout;
MapBean map;
TOCBean toc;
ToolbarBean toolbar;
JLabel statusLabel;

public MapViewerFrame(){
setTitle("MapViewer");
pageLayout=new PageLayoutBean();
map=new MapBean();
toc=new TOCBean();
toolbar=new ToolbarBean();
statusLabel=new JLabel(" ");
}

private JPanel buildMapTOCPanel(){
JPanel leftPanel=new JPanel();
JPanel bottomPanel=new JPanel();

leftPanel.setLayout(new BorderLayout());
bottomPanel.setLayout(new BorderLayout());
bottomPanel.setPreferredSize(new Dimension(200,200));
bottomPanel.add(map, BorderLayout.CENTER);
leftPanel.add(toc,BorderLayout.CENTER);
leftPanel.add(bottomPanel,BorderLayout.SOUTH);
return leftPanel;
}

public void buildAndShow()throws IOException{
JPanel mapTOCPanel=buildMapTOCPanel();
this.getContentPane().add(toolbar,BorderLayout.NORTH);
this.getContentPane().add(pageLayout,BorderLayout.CENTER);
this.getContentPane().add(mapTOCPanel,BorderLayout.WEST);
this.getContentPane().add(statusLabel,BorderLayout.SOUTH);
this.setVisible(true);
}
}

public class MapViewer{
public static void main(String[] args)throws IOException{
EngineInitializer.initializeVisualBeans();
//String laf=UIManager.getSystemLookAndFeelClassName();
//UIManager.setLookAndFeel(laf);
final AoInitialize aoInit=new AoInitialize();
aoInit.initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
MapViewerFrame mapViewerFrame=new MapViewerFrame();
Dimension d=Toolkit.getDefaultToolkit().getScreenSize();
int x=d.width/6;
int y=d.height/6;
int width=d.width*2/3;
int height=d.height*2/3;
mapViewerFrame.setBounds(x,y,width,height);
mapViewerFrame.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
try{
aoInit.shutdown();
}
catch(IOException ex){
ex.printStackTrace();
}
System.exit(0);
}
});
mapViewerFrame.buildAndShow();
}
}
eclipse exception arcobjects ?AutomationException
[解决办法]
你好,我也出了这个问题,是调用AO的那个XY_TO_Line的时候出现的,请问您的问题解决了吗,是怎么解决的?

热点排行