呼叫系统文本编辑器 [英] call system text editor

查看:87
本文介绍了呼叫系统文本编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用CSV文件的Java桌面应用程序.我想添加一些功能.此时,我需要使用默认系统文本编辑器打开选定的文件.当我在Windows上运行程序时,仅通过调用notepad.exe就没有问题,但是* nix系统怎么办?解决方案的一种方法是在程序选项中自定义设置首选文本编辑器的方法,但这不是最佳解决方案...

I have Java desktop application that works with CSV files. And i want add some functionality. At this moment i need to open selected file with default system text editor. When i run my program on Windows i have no problems, just by calling notepad.exe, but what to do with *nix systems? One way of solution is to customly set the way to preffered text editor in program options, but it is not a best solution...

但是,即使功能较少,还是最好将其添加到程序自己的文本编辑器中?

But maybe it would be better add to program own text editor, even with less functionality ?

推荐答案

我相信

I believe java.awt.Desktop.edit() may be what you're looking for, although it will launch whatever the OS thinks the file should be edited with, which in the case of CSV is usually a spreadsheet app rather than a text editor - maybe you can rename the files to TXT temporarily or permanently.

这篇关于呼叫系统文本编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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