Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » how to run junit test case in a customized Eclipse workspace?(show ` Cannot change the location once it is set.` when I set a certain path in filesystem programatically)
how to run junit test case in a customized Eclipse workspace? [message #1805796] Wed, 24 April 2019 08:43 Go to next message
Eclipse UserFriend
I created junit test by importing a project into a Eclipse workspace,
after running maven to build the product, I found the workspace located under the plugin which contains the junit testcase. /pluginname/work/data/,
under the data folder, I saw my imported project and .metadata, indicate that's the workspace.

However I want to set a workspace path at a filesystem, e.g. /home/productname/Testing.

I tried the following code to set the workspace manually, as suggested by other post.

Location instanceLoc = Platform.getInstanceLocation();
if (instanceLoc.isSet()) {
// release any previous location
instanceLoc.release();
String destination = "home/productname/Testing/";
URL value = new URL("file", null, destination); // $NON-NLS-1$
try {
instanceLoc.set(value, true);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
}

However it shows ` Cannot change the location once it is set.`

Anyone has any suggestion?
Thanks in advance.

[Updated on: Wed, 24 April 2019 08:45] by Moderator

Report message to a moderator

Re: how to run junit test case in a customized Eclipse workspace? [message #1811023 is a reply to message #1805796] Fri, 23 August 2019 18:14 Go to previous message
Eclipse UserFriend
How do you run the unit tests? If you run it with "run as junit plugin tests", you can change the workspace location in the run configuration.

Previous Topic:Fragment with resource
Next Topic:Plugin/Bundle remains in STARTING status
Goto Forum:
  


Current Time: Sun Feb 16 06:32:44 GMT 2025

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

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

Back to the top