18

I can open a file in exclipse, but is there any syntax to jump to a specific line?

VI can do this by

vi -c LINE filename
asked Feb 19, 2010 at 10:08
4
  • I can not understand what you mean by syntax,but keyboard shortcut CTRL+L will open a popup and you can enter line number there. Commented Feb 19, 2010 at 11:03
  • @Adi: CTRL+L would work only when "Editing Text", i.e if the file is already opened... Commented Feb 19, 2010 at 11:58
  • @Von He mentioned 'I can open a file in eclipse', I guess he already know how to open. Commented Feb 19, 2010 at 12:39
  • 3
    @Adi: I interpreted it as: "how to open file (not yet opened) directly to a specified line. Commented Feb 19, 2010 at 13:18

7 Answers 7

44

Not exactly the right answer, but for Java file, you can use the package explorer, or the outline view, useful to select a group of lines) and open the file to the line matching a Java element (class, method, variable, ...)

Eclipse open

Once the file is already opened, CTRL+L is the way to go to a line of the currently edited file, as Adi mentions in the comment.

answered Feb 19, 2010 at 11:54
Sign up to request clarification or add additional context in comments.

5 Comments

@abel: courtesy of faststone.org/FSCaptureDetail.htm FastStone Capture (not free, but worth every penny)
That screenshot is diabolical
@VonC you're telling us that you actually paid for the 45ドル family license so you can take prettier screenshots?
@krispy It was not 45$ at the time I purchased a license some 6 or 7 years ago, but it was worth every penny for the usage I had and still have of this software.
Now it's ~20$. :-) Seems to have a lot of good features.
13

Finally fixed!!

On Windows:

eclipsec.exe -name Eclipse --launcher.openFile %USERPROFILE%\workspace\MyClass.java:50

On Linux/Mac:

eclipse -name Eclipse --launcher.openFile ~/workspace/MyClass.java:50
answered Apr 19, 2016 at 16:10

Comments

10

Only tested on MARS:

Preferences> Keys> "Open from Clipboard"

Assign key binding.

  1. Copy i.e. log entry in format Main.java:1
  2. Press chosen key binding
  3. voilà

In latest Version [Oxygen] key was ctrl+shift+v

Sunil Kanzar
1,2601 gold badge9 silver badges22 bronze badges
answered Nov 23, 2015 at 12:05

1 Comment

This should be the accepted solution as its inbuilt into eclipse and allows for easy navigation fro m a log stack trace to the class file
8
  1. CTRL+SHIFT+R (Open Resource) or CTRL+SHIFT+T (Open Type, for classes only)

  2. Type the name / the start of the name / the first letters of a camel case name

  3. CTRL+L (Go to line)

answered Feb 19, 2010 at 12:01

Comments

3

Hmm. For me it works on Windows as simple as

eclipse.exe path\filename.ext:42


(I was actually looking for a consistent solution across IDEs.
Pycharm offers pycharm.exe path:number as well but it does not seem to work :/)

answered Jun 26, 2018 at 16:38

Comments

2

Try

eclipse.exe file.txt:22 

for newer versions of eclipse, and

eclipse.exe file.txt+178

for older ones.

answered Jul 9, 2018 at 7:05

Comments

0

Continuing from @raho's response, the complete menu path is: Window -> Preferences -> General -> Keys

This won't work on c++ as far as I can tell.

(I'm using Oxygen 4.7.1a)

answered Jan 8, 2018 at 19:11

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.