Skip to content

Tag: path

.jar File can’t find image file path

I’m creating a simple program that I now want to export as a executable jar file. Everything works fine except the jar file can’t find the image. For creating the runnable JAR file I used the second option in Eclipse 2021-12 (Package required libraries into generated JAR). This seems to work well, because I only have the jar and no

IntelliJ IDEA java directory paths problem

I have a problem with paths. I’ve got a test project like this below and I want to create a JSON reader in Main so I need a test_json path. I don’t wanna use an absolute path D:…, but a path “from project” (I mean smth like main://resources/json_test/test_json.json). Is there any way to do that? enter image description here Answer

How to get the inmediate child directory of a file path in Java?

I want to navigate the file system and get the path to the child of a directory (if exists) without the root. For example: Input: Users/Documents/SVG Output: Documents/SVG My solution so far is to hardcode a string manipulation of the path: Is there a more elegant way to do this? Answer Path.relativize() can help You can convert this Path back

How to create a Path to a non existent file

How can I create a Path to a file which is guaranteed not to exist? I thought about using an “impossible” path name, such as: But somebody could create such a file, making my code fail. Update I have written a method which accepts a Path and then tries to read from the underlying file, and now I am writing

How to downgrade JDK?

Currently my Java version is 17. Neo4j requires me to install Java 11 or OpenJDK 11, or else it will give the error java.lang.IllegalAccessException: module java.base does not open java.nio to unnamed module @1817d444. I guess I need to downgrade to JDK 11. Java Platform, Standard Edition 11 Reference Implementations is the only place I can get JDK 11. However

Get error when trying to split file path in Java

For the above code, I get the following output where p is a Path object. C:repoUnit-test-coverageabcdunit-test-repopcmbbsourcepcmbbdatabaseWorkOrderTenderUtil.plsql I want to get the file name without extension. So I tried the below code. Then I got the following output. WorkOrderTenderUtil.plsql To get the filename without extension what I tried to split the above output by .. But splitting is not happening as

Java path problems, ‘java’ is not recognized as an internal or external command, operable program or batch file. (javac too)

I know there are lot of questions like this but i tried their solutions and nothing. While i try to javac i get ‘javac’ is not recognized as an internal or external command, operable program or batch file. And java file ‘java’ is not recognized as an internal or external command,operable program or batch file. My environment path is