← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #281182]: Null pointer exception using Sikuli in Java

 

Question #281182 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/281182

    Status: Needs information => Open

Borja Miñano gave more information on the question:
There is the code I try to execute. It is a junit test simple, as I was
starting to integrate Sikuli as a conceptual test.

    public void testEditor() {
        try {
            Debug.setDebugLevel(3);
            Screen s = new Screen();
        }
        catch (Exception e) {
            e.printStackTrace(System.out);
            fail("Error: " + e.getMessage());
        }
    }

My pom.xml is quite long, I'll copy an extract with relevant information:
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
	<modelVersion>4.0.0</modelVersion>
...


	<dependencies>
	...
		<dependency>
			<groupId>com.sikulix</groupId>
			<artifactId>sikulixapi</artifactId>
			<version>1.1.0</version>
		</dependency>
		...
	</dependencies>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>1.4.0</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-Version>${pom.version}</Bundle-Version>
						<Bundle-Name>${pom.artifactId}</Bundle-Name>
						<Bundle-Vendor>${pom.organization.name}</Bundle-Vendor>
						<Bundle-Description>${pom.description}</Bundle-Description>
						<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
						<Export-Package>${pom.groupId}.${pom.artifactId}</Export-Package>
						<Import-Package>org.osgi.service.log,javax.xml.namespace, javax.xml.xpath,org.apache.xindice.client.xmldb,javax.swing, javax.swing.border, javax.swing.tree, org.json, 
							org.apache.xml.serialize, org.apache.commons.lang3, net.sf.saxon, net.sf.saxon.xpath, javax.xml.transform,javax.xml.parsers,javax.xml.validation,javax.xml.transform.dom,javax.xml.transform.stream,org.w3c.dom,org.xml.sax,org.osgi.framework;version="1.4.0"</Import-Package>
						<Bundle-Activator>${pom.groupId}.${pom.artifactId}.Activator</Bundle-Activator>
						<Bundle-ClassPath>., lib/gson-2.3.1.jar,lib/xsom-20081112.jar, lib/relaxngDatatype-2.2.jar, lib/xml-apis.jar, lib/sikulixapi-1.1.0.jar, lib/sikulix.jar, lib/sikulixsetup-1.1.0.jar</Bundle-ClassPath>
						<Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
					</instructions>
				</configuration>
			</plugin>

			...
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<version>2.2</version>
				<executions>
					<execution>
						<id>auto-clean</id>
						<phase>initialize</phase>
						<goals>
							<goal>clean</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			...
		</plugins>
	</build>
</project>

I am using sikuli jars internally in the bundle, so I declare them in the bundle-classpath to make them visible to the class loader.
They are visible, since Class.forName("org.sikuli.ide.SikuliIDE"); and Class.forName("org.sikuli.setup.RunSetup");  return the classes.
However, it cannot get the parent file, maybe because they are inside a bundle.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.