Windows中设置基于事件的计划任务

有时候希望在某种事件发生时执行相应的任务,比如:连接上某个WiFi或者VPN的时候添加特定的路由。

添加自定义事件筛选器
<QueryList>
  <Query Id="0" Path="Microsoft-Windows-NetworkProfile/Operational">
    <Select Path="Microsoft-Windows-NetworkProfile/Operational">*[System[ (EventID=10000)]][EventData[Data[@Name='Name']='Home']]</Select>
  </Query>
</QueryList>

 

在操作里,添加一个批处理文件即可。批处理文件处理添加路由的脚本。

No Compiler is Provided in this environment Perhaps you are running on JRE rather than a JDK

Jenkins流水线部署Java项目提示:No Compiler is Provided in this environment Perhaps you are running on JRE rather than a JDK

可能的原因是调用了/usr/bin/java,但是这个指向的是jre。

# ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Jul 4 2020 /usr/bin/java -> /etc/alternatives/java

如果是这样,要找到JDK的地址并更改软连接

#whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /data/soft/jdk1.8.0_151/bin/java /data/soft/jdk1.8.0_151/jre/bin/java /usr/share/man/man1/java.1.gz

rm /usr/bin/java
ln -s /data/soft/jdk1.8.0_151/bin/java /usr/bin/java