Directly using VirtualBox from Java #5
2 changed files with 57 additions and 22 deletions
|
@ -57,11 +57,16 @@
|
||||||
<version>6.0</version>
|
<version>6.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.virtualbox</groupId>
|
||||||
<artifactId>craftbukkit</artifactId>
|
<artifactId>VirtualBox-MSCOM</artifactId>
|
||||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
<version>6.0</version>
|
||||||
<scope>provided</scope>
|
</dependency>
|
||||||
</dependency>
|
<dependency>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>craftbukkit</artifactId>
|
||||||
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->
|
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.java.dev.jna</groupId>
|
<groupId>net.java.dev.jna</groupId>
|
||||||
|
@ -90,26 +95,56 @@
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<!-- <profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>XPCOM</id>
|
<id>XPCOM</id>
|
||||||
<dependencies>
|
<build>
|
||||||
<dependency>
|
<plugins>
|
||||||
<groupId>org.virtualbox</groupId>
|
<plugin>
|
||||||
<artifactId>VirtualBox</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>6.0</version>
|
<executions>
|
||||||
</dependency>
|
<execution>
|
||||||
</dependencies>
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<excludes>
|
||||||
|
<exclude>org.virtualbox:VirtualBox-MSCOM</exclude>
|
||||||
|
</excludes>
|
||||||
|
</artifactSet>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>MSCOM</id>
|
<id>MSCOM</id>
|
||||||
<dependencies>
|
<build>
|
||||||
<dependency>
|
<plugins>
|
||||||
<groupId>org.virtualbox</groupId>
|
<plugin>
|
||||||
<artifactId>VirtualBox-MSCOM</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>6.0</version>
|
<executions>
|
||||||
</dependency>
|
<execution>
|
||||||
</dependencies>
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactSet>
|
||||||
|
<excludes>
|
||||||
|
<exclude>org.virtualbox:VirtualBox</exclude>
|
||||||
|
</excludes>
|
||||||
|
</artifactSet>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles> -->
|
</profiles>
|
||||||
</project>
|
</project>
|
|
@ -67,7 +67,7 @@ public class PluginMain extends JavaPlugin {
|
||||||
System.setProperty("java.library.path", vbpath);
|
System.setProperty("java.library.path", vbpath);
|
||||||
Utils.addLibraryPath(vbpath);
|
Utils.addLibraryPath(vbpath);
|
||||||
final VirtualBoxManager manager = VirtualBoxManager.createInstance(getDataFolder().getAbsolutePath());
|
final VirtualBoxManager manager = VirtualBoxManager.createInstance(getDataFolder().getAbsolutePath());
|
||||||
VBoxLib vbl = LibraryLoader.create(VBoxLib.class).load("vboxjxpcom");
|
VBoxLib vbl = LibraryLoader.create(VBoxLib.class).load("vboxjxpcom"); //TODO: Test for MSCOM
|
||||||
vbl.RTR3InitExe(0, "", 0);
|
vbl.RTR3InitExe(0, "", 0);
|
||||||
IVirtualBox vbox = manager.getVBox();
|
IVirtualBox vbox = manager.getVBox();
|
||||||
listener = new VBoxEventHandler().registerTo(vbox.getEventSource());
|
listener = new VBoxEventHandler().registerTo(vbox.getEventSource());
|
||||||
|
|
Loading…
Reference in a new issue