Directly using VirtualBox from Java #5

Merged
NorbiPeti merged 60 commits from directvb into master 2019-04-18 23:29:21 +00:00
2 changed files with 57 additions and 22 deletions
Showing only changes of commit 3da76f075f - Show all commits

View file

@ -56,6 +56,11 @@
<artifactId>VirtualBox</artifactId> <artifactId>VirtualBox</artifactId>
<version>6.0</version> <version>6.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.virtualbox</groupId>
<artifactId>VirtualBox-MSCOM</artifactId>
<version>6.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
@ -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>

View file

@ -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());