Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Plug-in tests using JDT - no default VM found on Mac OS X
Plug-in tests using JDT - no default VM found on Mac OS X [message #1384672] Fri, 30 May 2014 08:33 Go to next message
Robert Munteanu is currently offline Robert MunteanuFriend
Messages: 30
Registered: July 2009
Member
Hi,

I'm running some plug-in tests which require a Java project to be built.
One of my colleagues noted that tests were failing on Mac OS X, while
they were working fine on Windows and Linux. The tests use Kepler as a
target platform.

Digging a bit deeper, he found out that there was no default JVM
library. The problems view reported a problem

Unbound classpath container: 'Default System Library' in project
'test-project-1'

I terms of JDT code, JavaRuntime.getDefaultVMInstall() returns null.

We tried to work around it by manually creating a new default VM:

final IVMInstallType vmInstallType =
JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
String id = null;
do {
id = String.valueOf(System.currentTimeMillis());
} while (vmInstallType.findVMInstall(id) != null);

VMStandin newVm = new VMStandin(vmInstallType, id);
newVm.setName("Default-VM");
File installLocation = new File(jrePath);
newVm.setInstallLocation(installLocation);
IVMInstall realVm = newVm.convertToRealVM();
JavaRuntime.setDefaultVMInstall(realVm, new NullProgressMonitor());

but I'm not really happy about it. There are two reasons:

1. It seems like we are working around a platform limitation, and
hopefully there's a simpler way to achieve our goal
2. Reconfiguring the default VM seems to need some amount of time, and
the call does not block until that's done.

So I have two questions:

1. Is there a way to ensure that test Eclipse runtime has a default VM
set up on Mac OS X?
2. If 1 is not possible, is there a way I can know when the default VM
is reconfigured, except using Thread.sleep and hoping for the best?

The code for the tests is available, see for instance [1].

Thanks,

Robert

[1]:
https://github.com/apache/sling/blob/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/BundleDeploymentTest.java#L112
Re: Plug-in tests using JDT - no default VM found on Mac OS X [message #1692768 is a reply to message #1384672] Fri, 17 April 2015 18:52 Go to previous message
Daniel Johnson is currently offline Daniel JohnsonFriend
Messages: 6
Registered: September 2010
Location: Seattle, WA
Junior Member

I realize this is nearly a year old, but raising it from the dead as I recently hit the issue trying to run UI Eclipse tests with Tycho in Maven 3. Your solution works perfectly to set the default JVM for OS X based systems.

The only thing I wanted to add, is instead of relying on Thread.sleep(), what if you wrap the operation in an IWorkspaceRunnable and run it with ResourcesPlugin.getWorkbench().run(runnable, monitor)? This is what I am doing and it seems to work great.

Thanks for the solution!
Previous Topic:Deployment Descriptor In Luna
Next Topic:[BUG] Content Assist "restore to defaults" does not restore to defaults
Goto Forum:
  


Current Time: Fri Apr 26 21:26:29 GMT 2024

Powered by FUDForum. Page generated in 0.02345 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top