javaubuntuintellij-ideajava-8java-console

Java/Ubuntu - Print outside of main works on Windows but does nothing on Ubuntu 14.04


I have an Intellij project. I compile ('Make') it on Windows, and sends it onto a Ubuntu 14.04 remote server, running Java 1.8.

My problem is that the System.out.println() outside of the main method prints nothing. I've spent a few hours on this problem, and I can ensure that :

N.B. To execute my project, I use : java MyProject.TestAlgo , with TestAlgo the main Class.


EDIT : I expect the output to be a List such as : [1.0, 2.3, ..., 5.4], but I get []

I don't think the problem is programming problem, because whenever I compile it on my computer which runs Windows, I get the prints from outside the main.

When I compile the project, and run it on the Ubuntu remote server, I don't see any output except the prints from the main, and the warnings raised by methods from outside main class. All methods trying to print and called in the main are declared static.


Solution

  • Solved :

    I was compiling Java with the 1.8.0.101 JDK version on Windows, and running it with the 1.8.0.91 on Ubuntu, which (I think) must have created version conflicts..

    I solved the issue by updating Java JRE so I had same versions of Java onto Windows and Ubuntu.