2012-08-29 37 views
0

嗨,大家好我有这个swing应用程序连接到托管数据库。它从本地文件“参数”中读取数据库参数。当我在本地运行它,它是能够从参数文件中读取参数,但是当我启动它使用Java Webstart的我得到这个异常:Webstart不读本地文件

java.io.FileNotFoundException: parameters.param(The system cannot find the File Specified)

有没有做了Java Webstart的读有益的方式该文件,因为应用程序不会连接到没有它的Db。

当我在JNLP文件Direactly双击验证不会来了,但使用的HTML页面,我不能运行: 我的HTML看起来像这样:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 

</head> 
<body> 
    <h3>Test page for launching the application via JNLP</h3> 
    <script src="http://java.com/js/deployJava.js"></script> 
    <script> 
     deployJava.createWebStartLaunchButton("launch.jnlp") 
    </script> 
    <!-- Or use the following link element to launch with the application --> 
    <!-- 
    <a href="launch.jnlp">Launch the application</a> 
    --> 
</body> 

+1

为什么不把这个文件包含在你的JAR中并通过'getResource()'读取? – trashgod

+1

另请参阅[本答案](http://stackoverflow.com/a/5052359/418556),以防参数需要随时间变化。 –

回答

0

放置在文件中该jar并使用getresource()来访问它解决了垃圾回收建议的问题。