Ich mache gerade meine ersten versuche in OSGi und habe mich dabei an ein Tutorial im Internet gehalten, weit gekommen bin ich allerdings nicht, weil ich, obwohl ich knopflerfisch gestartet habe und die relevanten jars als externe Jars dem Buildpath hinzugefügt habe, immer wenn ich nun das Antbuild laufen lassen will, die Fehlermeldung bekomme, dass die Jar nicht vorhanden ist, und zwar:
Ich habe im Anhang mal einen screenshot meiner Verzeichnisstruktur gemacht.
Hier meine build.xml:
Hier ist meine Activator.class:
Hier ist meine Manifestdatei:
Manifest-Version: 1.0
Name: ASimplebundle
Bundle-SymbolicName: ASimplebundle
Bundle-Version: 1.0.0
Bundle-Description: Demo Bundle
Bundle-Vendor: Vodafone Pilotentwicklung GmbH
Bundle-Activator: de.vpe.ASimplebundle.impl.Activator
Bundle-Category: example
Import-Package: org.osgi.framework
[javac] C:\Users\ICH\Documents\testworkspace\ASimplebundle\build.xml:13: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 2 source files to C:\Users\ICH\Documents\testworkspace\ASimplebundle\classes
[javac] C:\Users\ICH\Documents\testworkspace\ASimplebundle\src\de\vpe\simplebundle\impl\Activator.java:3: error: package org.osgi.framework does not exist
[javac] import org.osgi.framework.BundleContext;
Ich habe im Anhang mal einen screenshot meiner Verzeichnisstruktur gemacht.
Hier meine build.xml:
HTML:
<?xml version="1.0"?>
<project name="ASimplebundle" default="all">
<target name="all" depends="init,compile,jar"/>
<target name="init">
<mkdir dir="./classes"/>
<mkdir dir="./build"/>
</target>
<target name="compile">
<javac destdir = "./classes"
debug = "on"
srcdir = "./src">
</javac>
</target>
<target name="jar">
<jar basedir = "./classes"
jarfile = "./build/ASimplebundle.jar"
compress = "true"
includes = "**/*"
manifest = "./META-INF/manifest.mf"/>
</target>
<target name="clean">
<delete dir = "./classes"/>
<delete dir = "./build"/>
</target>
</project>
Hier ist meine Activator.class:
Java:
package de.vpe.simplebundle.impl;
import org.osgi.framework.BundleContext;
/**
* @author Sven Haiges | [email]sven.haiges@vodafone.com[/email]
*/
public class Activator {
public static BundleContext bc = null;
private HelloWorld thread = null;
public void start(BundleContext bc) throws Exception {
Activator.bc= bc;
this.thread = new HelloWorld();
this.thread.start();
}
public void stop(BundleContext bc) throws Exception {
this.thread.stopThread();
this.thread.join();
Activator.bc=null;
}
}
Hier ist meine Manifestdatei:
Manifest-Version: 1.0
Name: ASimplebundle
Bundle-SymbolicName: ASimplebundle
Bundle-Version: 1.0.0
Bundle-Description: Demo Bundle
Bundle-Vendor: Vodafone Pilotentwicklung GmbH
Bundle-Activator: de.vpe.ASimplebundle.impl.Activator
Bundle-Category: example
Import-Package: org.osgi.framework
Anhänge
Zuletzt bearbeitet: