[英]Java - Command Line on Linux: I don't have any output after I run the code
I am a beginner user of command-line.我是命令行的初学者。 I use Eclipse for my optimization problem with cplex.jar on my computer.我使用 Eclipse 来解决我计算机上 cplex.jar 的优化问题。 Since my computer is not enough for big problems, I try to use the school Linux server.由于我的电脑不够大问题,我尝试使用学校的Linux服务器。 I finally found a code piece that works without an error.我终于找到了一个没有错误的代码片段。 However, after I run this, I don't see anything(solving something etc).但是,在我运行它之后,我什么也没看到(解决问题等)。 Could you please help me to understand why I see nothing after this?你能帮我理解为什么在这之后我什么都看不到吗?
Before this code, I had many errors about my java files, my argument, jar file etc.在此代码之前,我对我的 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"
When I run my code, I see the following in Eclipse.当我运行我的代码时,我在 Eclipse 中看到以下内容。 I believe this is what I supposed to see in the server right?我相信这是我应该在服务器上看到的,对吧?
**************************************************.
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.
...Many other similar lines... ...许多其他类似的行...
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
You need to first compile and then execute the application.您需要先编译然后执行应用程序。 Assuming that you have src
directory with sources and out
directory for compiled classes:假设您有src
目录,其中包含用于编译类的源和out
目录:
$ cd PDP-TWT2
$ javac -source 1.8 -d ./out src/**/*.java
and then execute the class containing the main()
method:然后执行包含main()
方法的 class :
$ cd out
$ java MainPDP2 < ../Param.txt
Checkout Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program if want to learn more.结帐要点,第 1 部分,第 1 课:编译和运行一个简单的程序,如果想了解更多信息。 If you are using Java 11 this whole process is simplified with JEP 330: Launch Single-File Source-Code Programs .如果您使用的是 Java 11,则使用JEP 330 简化整个过程:启动单文件源代码程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.