我刚开始用Java编写anotations.我试着按照本教程编写自己的文章:使用Java注释处理
我写了一切就像它在那里,但在编译期间我收到一个错误:
Bad service configuration file javax.annotation.processing.Processor Provider <my class> not found.
Run Code Online (Sandbox Code Playgroud)
我正在使用netbeans和maven与插件maven-compiler-plugin v.2.5.1.和java源码v.1.8.
在我的pom.xml文件中,我有以下代码(如页面中所示):
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<!-- Disable annotation processing for ourselves. -->
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的操作系统是Linux(最好的ubuntu),maven是集成在Netbeans中的.
我试图谷歌它,但没有任何帮助我.所有教程都是针对旧版本的插件和Java.我尝试了maven-compiler-plugin的旧版本但没有效果.由于Java 8中引入了新功能,我无法切换到旧版本的Java.
非常感谢任何指点我如何解决它.
编辑:
以下是我的来源的完整列表:
Config.java
@Retention(RetentionPolicy.SOURCE)
@Target(value = {ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER})
public @interface Config {
String name();
String type();
String defaultValue();
}
Run Code Online (Sandbox Code Playgroud)
ConfigAnnotationProcessor.java
@SupportedAnnotationTypes(
{"sk.lieskove301.jianghongtiao.motionanalyser.config.ConfigAnnotations"}
)
public class ConfigAnnotationProcessor extends AbstractProcessor {
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
Messager messager = processingEnv.getMessager(); …Run Code Online (Sandbox Code Playgroud) 在C#我有以下代码:
public static float sum(List<float> array)
{
float result = 0.0f;
for (int i = 0; i < array.Length; i++)
result += array[i];
float lSum = array.Sum();
return result;
}
Run Code Online (Sandbox Code Playgroud)
为什么这两种"不同"方法的结果有所不同?
对于长度的数组911380元件导致 = 620246和lSum = 620235.8
什么是List.Sum的内部实现,哪个答案是正确的?它是C#语言/库的问题还是取决于Windows 中+的实现?
我们研究人类大脑和心脏活动,我们需要正确的结果,所以我感谢任何帮助!非常感谢提前.
我对服务的自动运行有疑问。我想在用户登录后运行脚本。一旦我成功了,但是当我尝试使其自动化时,就会遇到错误,并且找不到错误。
服务:
Description=Service desc
[Service]
Type=oneshot
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/albert/.Xauthority
Environment=HOME=/home/albert/
User=albert
Group=albert
RemainAfterExit=true
StandardOutput=journal
ExecStart=/home/albert/.startup-script.sh
[Install]
WantedBy=default.target
Run Code Online (Sandbox Code Playgroud)
位置:/home/albert/.config/systemd/user/startup-service.service
权限:-rw-r--r-- 1 albert albert 306 Jan 2 14:49 startup-service.service
脚本
权限:-rwxr-xrx 1 albert albert 86 Jan 2 13:30 /home/albert/.startup-script.sh
日志记录
Jan 02 17:03:27 irpi-epsilon systemd[734]: Service desc
-- Subject: Unit UNIT has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit UNIT has begun starting up.
Jan 02 17:03:27 irpi-epsilon systemd[1025]: startup-script.service: Failed at step GROUP spawning /home/albert/.startup-script.sh: Operation not permitted …Run Code Online (Sandbox Code Playgroud)