在命令行中的Eclipse中以调试模式运行程序 [英] Run a program in debug mode in eclipse in command line

查看:56
本文介绍了在命令行中的Eclipse中以调试模式运行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于多种原因,我必须在多台计算机重新启动的情况下测试程序.因此,我需要在计算机启动时打开eclipse,然后在eclipse上运行经过测试的程序(如果可能,则以调试模式运行).

For several reasons I must test my program with multiple computer restart. So I need at the computer startup, eclipse open and the tested program runs in eclipse (in debug mode if possible).

您能给我一个命令行或其他方式吗?我只需要在打开Eclipse或使用给定的命令行时自动启动程序

Can you give me a command line or another way to do that. I just need when I open eclipse or when I use the given command line, the program automatically start

谢谢

推荐答案

对于Linux操作系统(不确定在Win,Mac上),可以使用 xdotool 实用程序使Eclipse(或其他应用程序)自动化.假设您的应用程序已在Eclipse中以调试模式运行了至少一次,因此它在Debug历史记录中存在一个条目,那么Bash脚本可以执行以下操作

For Linux OS (not sure on Win, Mac), Eclipse (or other apps) can be automated with xdotool utility. Assuming your app has run at least once in debug mode within Eclipse so it exists an entry on Debug history, a Bash script could do the following actions

-编辑以下脚本,为应用设置正确的 position 值.
-启动 Eclipse .
-等待一段时间,直到完全恢复正常.
-执行以下命令序列:

-Edit the script below to set the correct position value for the app.
-Launch Eclipse.
-Wait some time until is fully up.
-Execute the following command sequence:

#!/bin/bash

position=6

#find Eclipse app window IDs, keep the last one
e_wid=$(xdotool search --class Eclipse | gawk 'END{print $0}')
# Create basic command string
cmd="xdotool windowactivate --sync $e_wid"
# Send key strokes with some delay in between
# Open Run menu
$cmd key Alt+r 
sleep 1
# select Debug option
$cmd key h
sleep 0.5
# pick the sixth option in that menu
$cmd key $position

建议将应用标记为收藏,以便在菜单中获得恒定的顺序.
要查看另一个示例,请在Github上查看此 mluis7要点.

It's recommended to mark the app as a favorite so it gets a constant order in the menu.
To see another example, check this mluis7 gist at Github.

这篇关于在命令行中的Eclipse中以调试模式运行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆