天天看点

如何在 Eclipse 中使用命令行

虽然我们已经有了像 eclipse 这样高级的 ide,但是我们有时候也是需要在开发的时候使用 windows 的命令行,来运行一些独立的程序。在两个程序中切换来切换去是很麻烦的。所以 eclipse 提供了这样的工具,让我们在 eclipse 中使用 windows 命令行。 

第一步:设置一个新的外部配置工具 

在 eclipse 中,选择 “run -> external tools -> external tools configurations” 

如何在 Eclipse 中使用命令行

第二步:点击 “new launch configuration” 

如何在 Eclipse 中使用命令行

第三步:new configuration 界面 

如何在 Eclipse 中使用命令行

第四步:提供命令行配置的详细信息 

name:就是你配置的名字,随便取 

location:cmd.exe 的文件位置 

working directory:就是命令行打开后的默认工作路径 

如何在 Eclipse 中使用命令行

第五步:选中“allocate console”复选框 

这个选项是把 eclipse 工作台作为命令行来获得输入和输出。 

如何在 Eclipse 中使用命令行

第六步:点击“run” 

你将打开一个 c: 为工作路径的命令行 

如何在 Eclipse 中使用命令行

第七步;几个简单的示例命令 

如何在 Eclipse 中使用命令行