Java calls cmd to execute MAVEN command

Source: Internet
Author: User
Tags nslookup disk defragmenter

First, the principle of introduction

Java runtime.getruntime (). EXEC (COMMANDSTR) can invoke the Execute CMD command.


Cmd/c dir is a closed command window after executing the dir command.

cmd/k dir does not close the command window after the dir command is executed.

cmd/c start dir will open a new window and execute the dir instruction, the original window will be closed.

cmd/k start dir will open a new window and execute the dir instruction, the original window will not be closed.

You can use CMD/view help information.

Second, Java calls CMD to execute the MAVEN package command

Original sticker: http://bbs.csdn.net/topics/390984997

See the recommendations in the post:

"Call cmd command in window, multiple commands perform intermediate" && "Connection"

"Semicolon is the separation method under Linux"

Try to write down the code, is running OK!

 Public class cmdutils {    publicstaticvoid  ExecCmd () {        runtime runtime=  Runtime.getruntime ();        String exec        try  {            runtime.exec ("cmd/k CD D:\\platform\\feature\\branch1 & & MVN Package ");         Catch (IOException e) {                    e.printstacktrace ();             }}}

iii. Common cmd commands
1. Gpedit.msc-----Group Policy
2. Sndrec32-------Recorder
3. Nslookup-------IP Address detector
4. Explorer-------Open Resource Manager
5. Logoff---------Logout command
6. Tsshutdn-------60 seconds Countdown shutdown command
7. Lusrmgr.msc----native Users and Groups
8. Services.msc---Local Service settings
9. oobe/msoobe/a----Check if XP is active
Notepad--------Open Notepad
cleanmgr-------Waste Finishing
Start Messenger Service----. Net start Messenger
Compmgmt.msc---Computer Management
. net stop Messenger-----Stop messenger Service
Conf-----------start NetMeeting
Dvdplay--------DVD Player
Charmap--------Start character mapping table
Diskmgmt.msc---Disk governance utility
Calc-----------Start-Up calculator
Dfrg.msc-------Disk Defragmenter
Chkdsk.exe-----CHKDSK disk Check
DEVMGMT.MSC---Device Management unit
regsvr32/u *.dll----Stop DLL file run
DRWTSN32------System Doctor
Rononce-p----15-second shutdown
DxDiag---------Checking DirectX information
Regedt32-------Registry Editor
Msconfig.exe---System Configuration Utility
Rsop.msc.-------Group Policy Result set
Mem.exe--------Show Memory usage
Regedit.exe----Registration Form
Winchat--------XP comes with LAN chat
ProgMan--------Program governing device
WINMSD---------System Information
PERFMON.MSC----Computer Performance monitoring Program
2.36. Winver---------Check the Windows version
Sfc/scannow-----Scan Errors and recover
Taskmgr-----Task Manager (2000/xp/2003
Winver---------Check the Windows version
Wmimgmt.msc----Open windows Governance Architecture (WMI)
Wupdmgr--------Windows Update
wscript--------Windows Script Host Settings
. Write----------WordPad
WINMSD---------System Information
Wiaacmgr-------Scanner and Camera Wizard
Winchat--------XP comes with LAN chat
Mem.exe--------Show Memory usage
Msconfig.exe---System Configuration Utility
Mplayer2-------Easy widnows Media Player
MSPaint--------Drawing Board
Wuyi mstsc----------Remote Desktop Connection
Mplayer2-------Media Player
Magnify--------Magnifier Utility
The. MMC------------Open the console
Mobsync--------Synchronization Command
DxDiag---------Checking DirectX information
DRWTSN32------System Doctor
DEVMGMT.MSC---Device Management unit
Dfrg.msc-------Disk Defragmenter
Diskmgmt.msc---Disk governance utility
DCOMCNFG-------Open System Component Services
DdeShare-------turn on DDE sharing settings
Dvdplay--------DVD Player
. net stop Messenger-----Stop messenger Service
The. Net start Messenger----Start Messenger Service
Notepad--------Open Notepad
Nslookup. Tool Wizard for-------Network governance
. ntbackup-------system backup and restore
Narrator-------Screen Narrator
Ntmsmgr.msc----Mobile Storage Manager
Ntmsoprq.msc---Mobile storage Administrator manipulation requests
Netstat-an----(TC) command Check interface
Syncapp--------Create a Briefcase
Sysedit--------System Configuration Editor
Sigverif.-------File Signature Validator
SNDREC32-------Recorder
SHRPUBW--------Create a shared folder
Secpol.msc-----Local Security Policy
SYSKEY---------System encryption, once encrypted can not be solved, to protect the Windows XP system dual Password
Services.msc---Local Service settings
Bayi. Sndvol32-------Volume Control program
Sfc.exe--------System File Checker
Sfc/scannow---Windows File Protection
TSSHUTDN-------60-second Countdown shutdown command
3.84. TSSHUTDN-------60-second Countdown shutdown command
Tourstart------XP profile (Travel XP program that appears after installation is complete)
Taskmgr--------Task Manager
EVENTVWR-------Event Viewer
Eudcedit-------Character-font procedure
. Explorer-------Open Resource Manager
Packager-------Object Wrapping Program
PERFMON.MSC----Computer Performance monitoring Program
ProgMan--------Program Management
Regedit.exe----Registration Form
94. rsop.msc-------Group Policy result set
Regedt32-------Registry Editor
Rononce-p----15-second shutdown
regsvr32/u *.dll----Stop DLL file run
98. regsvr32/u zipfldr.dll------Cancel Zip support
Cmd.exe--------cmd command prompt
Chkdsk.exe-----CHKDSK disk Check
101. Certmgr.msc----Certificate Governance Utility
102. Calc-----------Start Calculator
103. Charmap--------Start character mapping table
104. CLICONFG-------SQL SERVER Client Network Utility
CLIPBRD--------Clipboard Viewer
106. conf-----------start NetMeeting
107. Compmgmt.msc---Computer Management
108. cleanmgr-------Waste Finishing
109. Ciadv.msc------Indexing Service Program
OSK------------Open the On-screen keyboard
111. ODBCAD32-------ODBC Data source governance
oobe/msoobe/a----Check if XP is active.
113. Lusrmgr.msc----native Users and Groups
Logoff---------Logoff command
IExpress-------Trojan * * * tool, System comes with
Nslookup-------IP Address Detectors
117. Fsmgmt.msc-----shared Folder Manager
118. Utilman--------Auxiliary tool Manager
119. Gpedit.msc-----Group Policy
Explorer-------Open Resource Manager

Java calls cmd to execute MAVEN command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.