- 
                Notifications
    You must be signed in to change notification settings 
- Fork 65
Home
        ansj edited this page Jun 29, 2016 
        ·
        5 revisions
      
    In this project you can fast publish your API and schedule task, dynamic edit you java class and add or remove jar !
- 
- first you need jdk8(must) and maven(not must)
- to down last release war https://github.com/NLPchina/Jcoder/releases
- run it java -jar jcoder-[version].warand visit
 
- 
Click Test->Create-Task Code : package org.nlpcn.jcoder.run.java; import org.apache.log4j.Logger; import org.nlpcn.jcoder.run.annotation.DefaultExecute; import org.nutz.ioc.loader.annotation.Inject; public class TestRun { @Inject private Logger log; @DefaultExecute public String defaultTest(String name) throws InterruptedException { return "Hello Jcoder " + name; } } select TaskType : Activeand write some word to description now ClickSavebuttonnow you can use you api by : http://localhost:8080/api/TestRun?name=ansj 
- 
Click Test->Create-Task Code: package org.nlpcn.jcoder.run.java; import java.util.Date; import org.apache.log4j.Logger; import org.nlpcn.jcoder.run.annotation.DefaultExecute; import org.nlpcn.jcoder.util.DateUtils; import org.nutz.ioc.loader.annotation.Inject; public class CronTest { @Inject private Logger log ; @DefaultExecute public void execute() throws InterruptedException { Thread.sleep(10000L); log.info(DateUtils.formatDate(new Date(), DateUtils.SDF_FORMAT)); } }select TaskType : Activeand write some word todescriptionWrite Corn0/5 * * * * ?now ClickSavebuttonnow your job every 5`s run once! 