打开一个Java程序 [英] Open With... a java program

查看:124
本文介绍了打开一个Java程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何制作一个可以用来打开东西的java程序。例如:notepad ++,win zip ....我是否已经将jar转换为 .exe 第一个?另外,选择的文件是否传递给 String [] args



顺便说一句,我知道它适用于CMD,但那不是我要求的。

解决方案

取决于操作系统。在Windows下,你需要附加一些细节到注册表。



看看第三个答案在Java应用程序中使用文件关联为例

你也可以看看 http://www.rgagnon.com/javadetails/ java-0592.html



更新

操作系统执行程序,您应该通过 main 方法接收文件作为命令行参数。



I don不知道这是否适合您的需求,但您也可以看看文件关联Mac


I want to know how to make a java program that can be used to open stuff up. Ex: notepad++, win zip.... Do I have convert the jar to .exe first? Also, does the file chosen get passed in to String[] args?

By the way, I know that it works with cmd but thats not what I'm asking.

解决方案

Depends on the OS. Under windows, you need to attach some details into the registry.

Have a look at the 3rd answer in Utilising a file association in a Java application for an example?

You could also have a look at http://www.rgagnon.com/javadetails/java-0592.html

UPDATE

Also, when the OS executes the program, you should receive the file as a command line parameter through the main method

I don't know if this will work suit your needs or not, but you could also take a look at File association in Mac

这篇关于打开一个Java程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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