powtac
powtac

Reputation: 41070

How to open a file in Eclipse AND jump to a specific line?

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

Upvotes: 18

Views: 17140

Answers (7)

Master Yoda
Master Yoda

Reputation: 194

Try

eclipse.exe file.txt:22 

for newer versions of eclipse, and

eclipse.exe file.txt+178

for older ones.

Upvotes: 2

ewerybody
ewerybody

Reputation: 1590

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 :/)

Upvotes: 3

raho
raho

Reputation: 131

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

Upvotes: 10

makermarc
makermarc

Reputation: 1

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)

Upvotes: 0

krispy
krispy

Reputation: 1314

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

Upvotes: 13

VonC
VonC

Reputation: 1326782

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.

Upvotes: 44

Bozho
Bozho

Reputation: 597234

  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)

Upvotes: 8

Related Questions