Java - 在程序中创建新的文件扩展名
我的目标是为我正在创建的程序创建一个新的文件扩展名(可能不止一个)。因此,在四处查看之后,我找到了一些有关该主题的资源,如下所列,以防万一有人想查看它们并了解我一直在查看的内容。
<一个href="http://support.microsoft.com/?scid=kb%3Ben-us%3B185453&x=6&y=11" rel="nofollow noreferrer">http://support.microsoft.com/? scid=kb%3Ben-us%3B185453&x=6&y=11
http://www.rgagnon.com/javadetails/java-0592.html
< a href="http://www.rgagnon.com/javadetails/java-0480.html" rel="nofollow noreferrer">http://www.rgagnon.com/javadetails/java-0480.html
另外,请注意,Microsoft 支持实际上是 Visual Basic 课程,但我只是想看看是否有任何注册表变化的相似之处。
他们中的大多数人通常都会谈论进行一些注册表编辑,以便 Windows 可以识别新文件并知道如何处理它。然后我偶然发现了 Oracle 的此文档,该文档声称您能够使用一些(看似)简单的 Java 代码完成上述所有操作。我想如果这么简单的话,肯定有人已经指出了。另外,该文档是 2006 年的。我有很多问题,我知道这些问题需要解决很多问题,所以如果有人花时间回答这个问题,非常感谢!
- 为 Java 程序创建和关联文件类型的最佳方法是什么?
- 如果使用Oracle方法,是在完全独立的程序中完成的吗?我假设您不希望每次程序运行时都创建并关联文件类型,并且从我所见,这实际上会返回错误。
- 我希望其他人(仅限 Windows 用户)能够轻松安装该程序,但我使用的是 Windows 7 64 位。为了使关联也与 32 位系统兼容,我需要注意哪些更改?
- 使用这两种方法是否可以轻松且完全地逆转更改(即,如果我只想创建测试文件扩展名)?
我找不到任何广泛的资源来教授如何在没有先前知识的情况下做这类事情,所以如果有人不能回答我的问题,但确实有一个好的资源我可以看,那就太好了,也。
I'm aiming to create a new file extension (possibly more than one) for a program I'm creating. So, after looking around for a bit, I found a number of sources on the subject, listed below, just in case anyone wants to look at them and get the general idea of what I have been looking at.
Utilising a file association in a Java application
Create registry entry to associate file extension with application in C++
Associating file extensions with a program
http://support.microsoft.com/?scid=kb%3Ben-us%3B185453&x=6&y=11
http://www.rgagnon.com/javadetails/java-0592.html
http://www.rgagnon.com/javadetails/java-0480.html
Also, note that the Microsoft support one is actually a Visual Basic lesson, but I was just trying to see if there were any similarities in the registry changing.
Most of them generally talk about doing some registry editing so that Windows can recognize the new file and know what to do with it. Then I stumbled upon this document by Oracle, which claims that you are able to do all of the above with some (seemingly) simple Java code. I figure if it's that easy, though, somebody would have pointed it out already. Also, that document is from 2006. I've got a number of questions, which I understand can be a lot to go through, so if anyone takes time out to answer this, thanks a bunch!
- What's really the best way to go about creating and associating a file type for a Java program?
- If the Oracle method is used, is it done in a completely separate program? I would assume you don't want the file type being created and associated every time the program runs, and from what I've seen, that will actually return errors.
- I want other people (only Windows users) to be able to easily install the program, but I'm on Windows 7 64-bit. Are there any changes I should be aware of to make the association also compatible with 32-bit systems?
- Are the changes easily and completely reversible with either method (i.e. if I just wanted to create a test file extension)?
I couldn't find any extensive sources on teaching how to do this kind of stuff with no previous knowledge of it, so if anyone can't answer my questions, but does have a good source I can look at, that would be nice, too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Java Web Start 不仅是来自 Oracle 的免费安装程序,而且还可以注册一个应用程序。对文件类型感兴趣。有关示例,请参阅文件服务演示。
Java Web Start is not only a freely available installer that comes from Oracle, but it will also register an apps. interest in file types. See the File service demo. for an example.