.java文件使用mac终端正常java命令无法正常运行

时间:2015-02-13 21:25:33

标签: java eclipse macos terminal

我试图在this链接(特别是Plotter.java)中运行该程序。在zip文件中有关于如何运行它们的说明,但是他们没有我已经阅读了有关从终端运行java文件的其他问题,我已经应用了这些解决方案,但是没有一个在这个文件上工作但是我已经运行了其他代码而没有任何问题(java -dir或javac) )。 我怎么能运行这个程序? 我也想在eclipse控制台或eclipse中制作的GUI中运行它(绘图仪)

p.s:我没有包含任何代码,因为该程序有大约10个类,而且我是java的新手。

2 个答案:

答案 0 :(得分:1)

鉴于您发布的异常,问题是因为您没有为java提供正确的参数。该程序至少需要三个双倍的参数。

他们是:

minX (the first argument)
maxX (the second argument)
frequency (the third argument).

根据.zip中附带的说明: PlotEq:

java PlotEq <min-x> <max-x> <sample-rate> <Expression>
Where:
min-x: is the minimum value of x to begin plotting
max-x: is the maximum value of x to plot up to.
sample-rate: how close points are plotted to eachother. A sample rate of 0.1 is generally acceptable, it means take a sample of the graph at 0.1, 0.2, 0.3, 0.4, etc. Basically determines how much detail to include in the plot
Expression: the equation to plot
example:
java PlotEq -5 5 0.01 "sin(x)"
plots sin(x) between x=-5 and 5, taking samples every 0.01 steps in x.

问题在于min-x,max-x和sample-rate缺少参数。

答案 1 :(得分:0)

我试图查看代码,看起来你需要在命令行中给出double,而不是,所以它试图读取空数组的args。尝试在命令行中执行三个双精度的类名后写,它应该比。

如果你想在eclipse中运行相同的,请使用Eclipse的菜单:运行 - &gt;运行配置 - &gt; Java应用程序 - &gt;鼠标右键单击 - &gt;新 - &gt;参数 - &gt;添加一些你需要的参数。

请仔细阅读说明文件,它解释了一切。

相关问题