Xtext error: registered factory resource required

I have an application that accepts a file as input. Since the files are located elsewhere, the path will refer to the .jar location.

Example: D: \ Test \ JAVA_App \ Exe, where this .jar tester is located. So when I start at the Windows command prompt, I do the following: tester.jar D: \ Test \ JAVA_App \ Exe .... \ testcase1.txt

To process the file, my code calls ResourceSet from org.eclipse.emf.ecore.resource.ResourceSet. This is the code I have:

ResourceSet set = resourceSetProvider.get()
Resource resource = set.getResource(URI.createURI(<inputted path of file>))

I found out that the "registered factory resource is needed" error is not caused by the wrong path (I can open it if I run all the way on the command line), but because of the ".. \" between. If I use only ".... \ testcase1.txt", it works fine. But if it has "D: \" at the beginning with a ".." in between, an error occurs.

Is there any other way to use "D: \ Test \ JAVA_App \ Exe .... \ testcase1.txt" in xtext?

+4
source share
1 answer

I assume that D: is interpreted as a schema. Instead, try using 'URI.createFileURI ()'.

+6
source

All Articles