Java - Linux 上的命令行 : I don't have any output after I run the code

标签 java linux command-line javac cplex

我是命令行的初学者。我使用 Eclipse 来解决计算机上 cplex.jar 的优化问题。由于我的电脑不足以解决大问题,所以我尝试使用学校的Linux服务器。我终于找到了一个没有错误的代码片段。然而,在我运行这个之后,我没有看到任何东西(解决问题等)。您能帮我理解为什么我在此之后什么也看不到吗?

在这段代码之前,我的 java 文件、参数、jar 文件等有很多错误。

javac -source "1.8" -cp ".:./PDP-TWT2/cplex.jar" PDP-TWT2/src/MainPDP2.java PDP-TWT2/src/Node.java PDP-TWT2/src/Vehicle.java PDP-TWT2/src/Arc.java < "PDP-TWT2/Param.txt"

当我运行代码时,我在 Eclipse 中看到以下内容。我相信这就是我应该在服务器中看到的内容,对吗?

 **************************************************.
Warning:  Output names have been modified to conform to LP format.
Tried aggregator 2 times.
MIP Presolve eliminated 1604 rows and 96 columns.
MIP Presolve modified 244 coefficients.
Aggregator did 180 substitutions.
Reduced MIP has 3299 rows, 1970 columns, and 11256 nonzeros.
Reduced MIP has 1942 binaries, 0 generals, 0 SOSs, and 0 indicators.
Presolve time = 0.01 sec. (11.67 ticks)
Probing fixed 12 vars, tightened 0 bounds.

...许多其他类似的行...

        Nodes                                         Cuts/
   Node  Left     Objective  IInf  Best Integer    Best Bound    ItCnt     Gap

      0     0       35.5800    72                     35.5800      891         
      0     0       36.3600    90                    Cuts: 68     1290         
      0     0       36.3600   102                    Cuts: 68     1644

最佳答案

您需要先编译然后执行应用程序。假设您有包含源代码的 src 目录和用于编译类的 out 目录:

$ cd PDP-TWT2
$ javac -source 1.8 -d ./out src/**/*.java 

然后执行包含main()方法的类:

$ cd out
$ java MainPDP2 < ../Param.txt

结账 Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program如果想了解更多。如果您使用的是 Java 11,则整个过程可通过 JEP 330: Launch Single-File Source-Code Programs 进行简化。 .

关于Java - Linux 上的命令行 : I don't have any output after I run the code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58647838/

相关文章:

ubuntu - 命令开始的颜色终端线

linux - 如何仅从文件中删除第一行范围?

Windows自动多用户登录命令行

php - 从门户下载文件

python - 如何将Azure应用服务Python版本从3.9.7更改为3.9.12?

java - Akka:获取 Actor 总数

java - 默认的 java cacerts 不起作用

Linux - 按日期字段排序文件

java - Set 中的每个元素如何成为 Map.Entry 对象?

java - 如何在 Android 上安全地存储存储敏感日期?