Answer the question
In order to leave comments, you need to log in
C++ file path?
The story is this, in java there is a file on a relative path (res/filetxt/txt1.txt), from java I load the C ++ code that is closed in the DLL. And when this code is executed, I have to read this very file, how can I specify the relative path? and regarding what it will be, the whole joke is that as a result I throw off the jar file to another PC, and the C ++ code does not see this very txt , it turns out now that the full path of this very file depends on the location of the jar itself?
Answer the question
In order to leave comments, you need to log in
It's actually good to hide such things in resources, and load them relatively via getResource()
Here it is written in detail - https://skipy-ru.livejournal.com/5343.html
Well, the current directory can be obtained like this
Path currentRelativePath = Paths.get("");
String s = currentRelativePath.toAbsolutePath().toString();
System.out.println("Current relative path is: " + s);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question