| Summary: | wrong result while running class with no main method but having static block | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Manish Nischal <m.nischal> | ||||
| Component: | Debug | Assignee: | JDT-Debug-Inbox <jdt-debug-inbox> | ||||
| Status: | CLOSED INVALID | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 4.5 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Ctrl+F11 runs the last launched application and hence you are getting results from the previous runs. |
Created attachment 245923 [details] wrong result Hello, I am using eclipse luna Version: Luna Release (4.4.0) Build id: 20140612-0600 and java java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode). While running a class with no main method but having a static block(by pressing Ctrl+F11 or by using the run button), eclipse is showing the different results on different machines. As per java 1.7 , it should throw below error. Error: Could not find or load main class NoMain sample class is given below. public class NoMain { static{ System.out.println("In static"); test(); } static void test(){ System.out.println("In test"); } } Please find attached the screen shot.