java 代码打开一个dos窗口

try { Runtime.getRuntime() .exec("cmd.exe /C start", null, new File("c:/")); System.out.println("finish"); } catch (IOException e) { e.printStackTrace(); }

可以通过java 代码打开一个dos窗口

if (selection instanceof IStructuredSelection) { Object sel = ((IStructuredSelection)selection).getFirstElement(); if (sel instanceof PlatformObject) { PlatformObject p = (PlatformObject)sel; IResource resource = (IResource)p.getAdapter(IResource.class); if (resource != null) { return getPath(resource); } } if (sel instanceof IResource) { IResource res = (IResource)sel; if (res != null) { return getPath(res); } } if (sel instanceof IJavaElement) { IJavaElement je = (IJavaElement)sel; try { IResource correspondingResource = je.getCorrespondingResource(); if (correspondingResource != null) getPath(correspondingResource); } catch (JavaModelException localJavaModelException) { } } if (sel instanceof IPluginModel) { IPluginModel mod = (IPluginModel)sel; String installLocation = mod.getInstallLocation(); return installLocation; } if (sel instanceof IJarEntryResource) { IJarEntryResource jar = (IJarEntryResource)sel; IPath fullPath = jar.getFullPath(); return fullPath.makeAbsolute().toOSString(); } if (sel instanceof IAdaptable) { IAdaptable ad = (IAdaptable)sel; IResource resource = (IResource)ad.getAdapter(IResource.class); if (resource != null) { return getPath(resource); } }

根据ISelection取得 ISelection得到的资源路径

public void logError(String msg, Throwable t) { ILog log = getDefault().getLog(); Status s = new Status(4, PLUGIN_ID, msg, t); log.log(s); }

插件在运行的时候运行System.out.println 是不起作用的,必须使用记录日志的方式来显示打印信息,可以用以上方式

 

mvn 执行java main程序:

mvn exec:java -Dexec.mainClass=com.koubei.kac.alipaytaobaocooperate.CAEAlipayCooperate

详细:http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html

 

如果碰上一个本地仓库中没有的jar包,那需要事先安装到本地的jar中,可以尝试使用下面的命令:

 

mvn install:install-file -Dpackaging=jar -DartifactId=koubei-core-web-tag -DgroupId=com.koubei -Dfile=./koubei-cor

e-web-tag-1.0.3-20110506.080829-2.jar -Dversion=1.0.3-SNAPSHOT

 

下载jar代码的同时下载代码包的源代码包:

mvn eclipse:eclipse -DdownloadSources=true (这里一定要用eclipse:eclipse 这个 插件,不然的话不会下载源代码包)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值