A Java spoof applet

Source: Internet
Author: User

Using Java to control the operation of an application (take NetEase cloud Music as an example), the steps are as follows

1, the establishment of BAT file is Start.bat (control program Operation) and Kill.bat (control program end);

The Start.bat content is as follows, the function is to run the Program:

cmd/c start f:\\00 NetEase Cloud Music \\CloudMusic\\cloudmusic.exeexit

Depending on the situation, you can rewrite the installation path for your Application.

The Kill.bat content is as follows, the function is to end the program Process:

Taskkill/f/im "cloudmusic.exe" exit

Note: two files to be in the same directory as the Application's directory

2. Find the installation directory of NetEase cloud or other application my is F:\00 NetEase cloud music \cloudmusic\;

3, Write Java code Control application operation such as (let the application run, run a period of time after a sudden end, a while good, so repeated) the program start time and end time interval to small, is not a spoof of the small program, so that your small partner is very vexed ah, listen to the song when the Break. La La la

4, attach the code, the key parts have Notes.

Package Haowan;import Java.io.ioexception;import Java.util.timer;import Java.util.timertask;public class Haowan { public void Runbat (string Batname) {//start netease cloud music String cmd = "cmd/c start f:\\00 netease Cloud Music \\CloudMusic\\" + Batname +             ". bat";//netease Music installation directory E:/wyyyy/cloudmusic/try {Process PS = runtime.getruntime (). exec (cmd);         Ps.waitfor ();         } catch (ioexception Ioe) {ioe.printstacktrace ();         } catch (interruptedexception E) {e.printstacktrace ();     } System.out.println ("open NetEase cloud music"); } public void Shutbat (string Batname) {//turn off NetEase cloud music String cmd = "cmd/c start f:\\00 netease Cloud Music \\CloudMus ic\\ "+ batname +". bat ";//netease Music installation directory E:/wyyyy/cloudmusic/try {Process PS = runtime.getruntime (). E                Xec (cmd);            Ps.waitfor ();            } catch (ioexception Ioe) {ioe.printstacktrace ();     } catch (interruptedexception E) {           E.printstacktrace ();        } System.out.println ("turn off NetEase Cloud music");            } public static void main (string[] Args) {timer timer = new Timer ();//time controller timer.schedule (new timertask () {            public void Run () {haowan Haowan = new Haowan ();            Haowan.runbat ("start");            }}, 3000, 300000);//3 Second start running NetEase cloud music every 5 minutes seconds to restart the timer timer2 = new Timer ();//time Controller Timer.schedule (new timertask () {            public void Run () {haowan Haowan = new Haowan ();            Haowan.runbat ("kill"); }}, 295000, 300000);//4 minutes 55 seconds off run NetEase cloud music closed every 5 minutes}}

A Java spoof applet

Related Article

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.