John Kangari
John Kangari

Reputation: 41

System.out.println() not working in windows

Thank you for your replays. I'm writing this code using eclipse on ububntu OS.

this is my code:

public class test{
     public static void main (String[] args){
             System.out.print("Hello world");
     }
}

Then make it by using eclipse export JAR Executable file.

I run the code under ubuntu terminal like this:

java -jar test.jar

so I got the Hello world string, and this is the result: Screen shot on ubuntu

And running the same command on the command prompt of windwos 8.1 x86.

java -jar test.jar

And the result is this: Result on windows

Thank you again for helping.

Upvotes: 1

Views: 2513

Answers (2)

Pankaj Pandey
Pankaj Pandey

Reputation: 1043

This might be the classpath issue , use below code to run. -verbose will print you the execution details.

set classpath=.;
java -verbose -jar helloworld.jar

Upvotes: 1

Adriaan Koster
Adriaan Koster

Reputation: 16209

Please show us your code and the way you run it.

First idea: make sure you run your code on the command line:

  • open DOS box
  • cd to the directory where your .jar file is
  • java -jar helloworld.jar

You might not see any console output if you double-click the .jar file

Upvotes: 0

Related Questions