开发者

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

I can ope开发者_高级运维n a file in exclipse, but is there any syntax to jump to a specific line?

VI can do this by

vi -c LINE filename


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, ...)

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

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.


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


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


  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)


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


Try

eclipse.exe file.txt:22 

for newer versions of eclipse, and

eclipse.exe file.txt+178

for older ones.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜