将参数传递给Java Interpreter所需的JAR [英] Passing arguments to JAR which is required by Java Interpreter

查看:102
本文介绍了将参数传递给Java Interpreter所需的JAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行我的 java应用程序时,我需要传递Java解释器为Flash图像所需的参数。

When i execute my java application i need to pass arguments which is needed by Java interpreter for Flash image.

例如。 java -sum_arg演示

for eg. java -sum_arg Demo

现在我想为我的应用程序创建JAR文件,如何克服需要参数。

Now i want to create JAR file for my application and how can i overcome need of arguments.

推荐答案

您可以将参数传递给打包到 .jar 文件中的Java应用程序,就像使用单个一样.class files:

You can pass arguments to Java applications packed into .jar files just as you can with single .class files:

java -jar MyApp.jar anArgument

如果您关心用户只需双击 .jar 运行你的应用程序的文件,然后你可能想要考虑使用真实的UI(例如使用Swing)。

If you care about the UI case where a user simply double-clicks the .jar file to run your application, then you might want to consider using a real UI (using Swing, for example).

以这种方式获得输入的简单方法是使用 JOptionPane

A simple way to get input this way would be with a JOptionPane:

String myInput = JOptionPane.showInputDialog("Enter something!");

这篇关于将参数传递给Java Interpreter所需的JAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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