在Mac OS中将注册表与JAVA结合使用 [英] Using Registry with JAVA in Mac OS

查看:163
本文介绍了在Mac OS中将注册表与JAVA结合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 Windows 平台上编写了一个 Java 桌面应用程序,该应用程序使用 Windows注册表来保存应用程序信息,例如应用程序的位置,时间段(例如30天之内的免费试用)等

I have written a Java desktop application in Windows platform that is using the Windows Registry to save the application information like location of the application, time-period (like free-trial up to 30 days ) etc.

现在,我想创建相同的Java应用程序以在 Mac OS 上运行.尽管大多数Java代码都是相同的,但我不确定Mac OS中的注册表概念. 与Windows平台一样,Mac Os中是否有任何 注册中心 .如果是,我如何将Mac Registry与JAVA结合使用来编写应用程序信息?

Now, i want to create the same java application to run on Mac OS. Although the most of the java code will be same but i am not sure about the Registry concept in Mac OS. Is there any Registry in Mac Os like in Windows platform. If yes, how can i use the Mac Registry with JAVA to write application information?

此致

阿伦·库玛(Arun Kumar)

Arun Kumar

推荐答案

java.util.prefs机制是处理此类问题的跨平台方式.在Windows上,它由注册表支持,在Mac上,它由~/Library中的.plist文件支持,而在Linux和朋友中,它由~/.java中的文件支持,但是用于访问信息的API都相同平台.

The java.util.prefs mechanism is the cross-platform way to approach this sort of thing. On Windows it's backed by the registry, on Mac it's backed by .plist files in ~/Library, and on Linux and friends it's backed by files in ~/.java, but the API you use to access the information is the same on all platforms.

这篇关于在Mac OS中将注册表与JAVA结合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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