gpt4 book ai didi

java - 读取环境变量失败

转载 作者:太空宇宙 更新时间:2023-11-04 06:19:39 25 4
gpt4 key购买 nike

我正在安装 eclipse 插件,ArcGis Runtime SDK for java,但是当我创建一个简单的 map 应用程序然后运行它时,它不正确

我的代码:

import java.awt.EventQueue;
import javax.swing.JFrame;
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import com.esri.runtime.ArcGISRuntime;
import com.esri.map.JMap;
import com.esri.map.MapOptions;
import com.esri.map.MapOptions.MapType;

public class coba2class {

private JFrame window;
private JMap map;

public coba2class() {
window = new JFrame();
window.setSize(800, 600);
window.setLocationRelativeTo(null); // center on screen
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.getContentPane().setLayout(new BorderLayout(0, 0));

// dispose map just before application window is closed.
window.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent windowEvent) {
super.windowClosing(windowEvent);
map.dispose();
}
});

// Before this application is deployed you must register the application on
// http://developers.arcgis.com and set the Client ID in the application as shown
// below. This will license your application to use Basic level functionality.
//
// If you need to license your application for Standard level functionality, please
// refer to the documentation on http://developers.arcgis.com
//
//ArcGISRuntime.setClientID("your Client ID");

// Using MapOptions allows for a common online basemap to be chosen
MapOptions mapOptions = new MapOptions(MapType.TOPO);
map = new JMap(mapOptions);

// If you don't use MapOptions, use the empty JMap constructor and add a tiled layer
//map = new JMap();
//ArcGISTiledMapServiceLayer tiledLayer = new ArcGISTiledMapServiceLayer(
// "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
//map.getLayers().add(tiledLayer);

// Add the JMap to the JFrame's content pane
window.getContentPane().add(map);

}

  /**
* Starting point of this application.
* @param args
*/

public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {

@Override
public void run() {
try {
coba2class application = new coba2class();
application.window.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});

}}

在我运行这个之后,我收到了这个警告。

Java version : 1.8.0_25 (Oracle Corporation) amd64 Rendering engine : DirectX java.lang.RuntimeException: Unable to find runtime installation. Searched following places: F:\coba2 Failed to read environment variable ARCGISRUNTIMESDKJAVA_10_2_4
com.esri.runtime.ArcGISRuntime.getInstallDirectory(Unknown Source)
com.esri.runtime.ArcGISRuntime.a(Unknown Source)
com.esri.runtime.ArcGISRuntime.getClientLibPath(Unknown Source)

最佳答案

当您的应用程序找不到 ArcGIS Runtime 部署时,就会发生这种情况。

如果您在安装了 ArcGIS Runtime SDK for Java 的计算机上运行,​​请将环境变量 ARCGISRUNTIMESDKJAVA_10_2_4 的值设置为 arcgisruntime10.2.4 所在的目录。默认值为 C:\Program Files (x86)\ArcGIS SDKs\java10.2.4,但 SDK 安装程序应已为您设置此环境变量。

如果您在未安装 ArcGIS Runtime SDK for Java 的计算机上运行,​​create a Runtime deployment并将其放置在您的应用程序的工作目录中(在您的情况下为 F:\coba2 )。这是将 ArcGIS Runtime 部署到最终用户计算机的方法。

或者,您可以使用 ArcGISRuntime.setInstallDirectory(String) 以编程方式设置包含 ArcGIS Runtime 部署的目录。 ,但我不建议这样做,因为这样您的应用程序将要求运行时部署位于每台计算机上的同一目录中。

关于java - 读取环境变量失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27566529/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com