在Java应用程序中使用文件关联 [英] Utilising a file association in a Java application

查看:155
本文介绍了在Java应用程序中使用文件关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个基于Swing的跨平台应用程序,我想在其中使用已在操作系统中注册的文件关联。

I am in the process of writing a cross platform Swing based application in which I want to utilize a file association which has been registered with the OS.

所以iv到了我可以点击文件并加载我的应用程序的地步,但我需要知道的是如何让我的应用程序知道启动它的文件的位置,然后查询内容。

So iv got to the point where I can click on a file and my app loads, but what I need to know is how I can get my application to know where the file is that launched it and then query the contents.

我是否还需要进行文件关联注册?或者Java可以为我做这个吗?

Is there something further I have to do with the file association registration? Or can Java do this for me?

推荐答案

我不是肯定的,但我希望文件的名称你按文件点击处理将最终进入你的 main()方法的参数。你试过/检查了吗?

I'm not positive, but I'd expect that the name of the file you're processing by file click will end up in the arguments to your main() method. Have you tried/checked that?

这篇关于在Java应用程序中使用文件关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆