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?
source
share