Java getServiceNames()返回null。为什么?

Java getServiceNames()返回null。为什么?,java,jnlp,Java,Jnlp,我有一个能够保存和加载文件的小应用程序。然后我决定尝试JavaWebStart,所以我需要将JFileChooser的用法重写为jnlp 看看我,我试着重写我的代码 这是我带来的 FileSaveService fss = null; FileContents fileContents = null; ByteArrayInputStream is = new ByteArrayInputStream( (new String("Saved by JWSFileChooserDemo")

我有一个能够保存和加载文件的小应用程序。然后我决定尝试JavaWebStart,所以我需要将JFileChooser的用法重写为jnlp

看看我,我试着重写我的代码

这是我带来的

FileSaveService fss = null;
FileContents fileContents = null;
ByteArrayInputStream is = new ByteArrayInputStream(
    (new String("Saved by JWSFileChooserDemo").getBytes()));
try {
    String[] services = ServiceManager.getServiceNames();
    fss = (FileSaveService)ServiceManager.
                    lookup("javax.jnlp.FileSaveService");
}
catch (UnavailableServiceException exc) { }

if (fss != null) {
    try {
        fileContents = fss.saveFileDialog(null, null, is, null);
}
等等

起初没有
ServiceManager.getServiceNames
调用,而
ServiceManager.lookup
返回null。所以我决定获取服务列表,
getServiceNames
也返回null

如何查找
文件保存服务
?该方法在哪里查找该服务,我是否应该在某处写一些额外的东西来声明我需要该服务


UPD:我试图从上面的oracle链接运行JWSFileChooserDemo,但它不起作用。与
ServiceManager相同。查找
返回空值。

这些服务仅在应用程序启动时可用。使用JWS启动。它们在双击的可执行Jar中不可用。它们在从命令行或批处理文件启动的
java-jar..
中不可用。它必须类似于或从本地服务器上的链接启动JNLP。@AndrewThompson,非常感谢您的回答!所以如何使用eclipse或NetBeans进行调试?