Go to Windows->Preferences

In the preferences window, expand Java->Editor.

Make sure the Editor is selected.

On the right side panel, under the Appearance tab, make sure the check-box Show line numbers is checked.

Click Ok to save the new setting.