简体   繁体   English

Java - Linux 上的命令行:运行代码后我没有任何 output

[英]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.

相关问题 当我运行我的代码(在 Eclipse 中)时,为什么我没有得到任何 output? - Why don't I get any output when I run my code (in Eclipse)? 我想通过命令行安装Java,但没有sudo访问权限。 - I want to install Java through the command line but I don't have sudo access. 如何从Java代码运行命令并读取输出? - How can I run command from Java code and read the output? 如何在后台运行Java代码中的命令行? - How do I run command line from Java code in the background? 为什么我不能在命令行中运行 .java 文件? - Why I can't run a .java file in the command line? 有没有办法为下次运行保存JAVA JIT信息,这样我就不必每天都热身了代码? - Is there a way to save the JAVA JIT information for the next run so that i don't have to warm up the code every day? 当我从 Linux 的命令行运行 Java class 文件时,为什么会出现 NoClassDefFoundError? - Why am I getting a NoClassDefFoundError when I run a Java class file from the command line in Linux? 虽然我已经提到了它的代码,但当我没有提供任何输入时,我的应用程序会关闭 - My app shuts down when I don't give any input though I have mentioned the code for it 我可以编译依赖.class文件的java代码吗?我没有源.java文件? - Can I compile java code that relies on a .class file and I don't have the source .java file? java I / O:为什么输入和输出流不必匹配? - java I/O : why don't input and output streams have to match?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM