2

I have an issue with Eclipse that has baffled me and I've tried everything I know to try.

I have the simplest print statement:

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

When I open eclipse from the .exe file (or any shortcut) this executes, and leaves a <terminated> main[Java Application] ... note above the console, but there is no output.

If I open Eclipse from the installer (clicking the launch button after the install completes) this prints and works fine.

When opening from the .exe (without re-installing eclipse) NONE of my other applications will print to the console. Creating a new java project and writing a "hello world" application also does nothing.

I'm not 100% familiar with eclipse, but I have checked all the following:

  1. I am using 64 bit versions of both Eclipse and jre
  2. Verified "Allocate Console" is checked in the run configurations from this
  3. Not getting any errors in the Event Viewer or anywhere visible in the console/Eclipse
  4. Can run the application from the command line and DO get output this way.
  5. Checked the dropdown/toggle on the console and viewed all versions, the output is not on any of them.
  6. Restarted Eclipse, and the Machine in case there were any orphaned instances of the app running causing this behavior.
  7. Deleted and created a new workspace with a new "Hello World" project.

Because of #4 and the fact that this was working not that long ago convinces me this is an Eclipse issue.

Note

I am on a Windows 7 64 bit machine.
Using Eclipse Neon
jdk1.8.0.101

I can temporarily work around this issue by running the installer, "installing" Eclipse (which is fast, because it's already installed) and then clicking the "Launch" button that shows up afterwards. When I do this, the print statement works and the application runs as expected.

Community
  • 1
  • 1
leigero
  • 3,233
  • 12
  • 42
  • 63
  • Did you try to restart Eclipse? Also try going to Window -> Show View -> Console; confirm in that tab that there is no red square in the console view. That means some other app is still running. If so, stop it. You may have to click it multiple times. – Kon Oct 12 '16 at 19:51
  • @kon I have restarted Eclipse and the computer itself just in case there were some orphaned applications running somewhere. The console is visible and there are no other applications running to stop. – leigero Oct 12 '16 at 19:52
  • Hmm, another thing you could try is the suggestion here: http://stackoverflow.com/questions/27632355/eclipse-console-not-showing-output beyond that, seems like an annoying Eclipse bug. Are you on windows? – Kon Oct 12 '16 at 19:59
  • Also note that in the console Window, there's a little dropdown on the right side which lets you choose which console you want to display. Toggle through those options and see if you can see some output in one of them – Kon Oct 12 '16 at 20:00
  • @kon I will update the question. I have done that dropdown toggle thing as well and none of those options have the output. Also I am on Windows, yes. – leigero Oct 12 '16 at 20:01
  • Unfortunately I'm running out of ideas. I wonder if there's some issue with it finding your Standard output (which is what `out` uses). Try loop and printing something to standard err. `System.err.println("Hello");` – Kon Oct 12 '16 at 20:21
  • Try to check the settings in "Preferences" > "Run/Debug" > "Console" > "Show when..."? – beat Oct 12 '16 at 20:27
  • @beat I just enabled them both after Kon suggested to print something to 1System.err1, but it didn't help. – leigero Oct 12 '16 at 20:32
  • @leigero to be sure it is not a settings thing you might try to create a whole new workspace and then a new simple project. eclipse stores preferences in workspace (and some in project). – beat Oct 13 '16 at 07:23
  • @beat that didn't seem to solve the problem. Updated the question. – leigero Oct 13 '16 at 13:26
  • @leigero try to use eclipse mars to see if it is a problem with neon, if it does the same then try to downgrade the JDK and see if this changes something. if not then there is something wrong with your environment (system variables, profile settings etc.). I personally never had that problem, it just works. – beat Oct 14 '16 at 08:07

1 Answers1

0

You will need to install the Java EE Developer Tools:

  1. In Eclipse, go to Help>Install New Software
  2. When the Install (Available Software) option opens, change the Work With: drop down box to Neon – http://download.eclipse.org/releases/”your version of eclipse”/
  3. Select the option Web, XML, Java EE and OSGI Enterprise Development and under this directory select Eclipse Java EE Developer Tools
  4. Follow the wizard through the install, Eclipse will the prompt you to restart.
  5. Once you restart Eclipse and Run a Java program, you will now see the results in the Console Output.
Martin Evans
  • 45,791
  • 17
  • 81
  • 97
sharkbyte
  • 33
  • 7