Answer the question
In order to leave comments, you need to log in
How to open another file in java?
Hello to all forum members. I am a beginner java programmer.
My problem is this. I have a file for the word say 123.exe. How can I open it with java. I looked all over and everywhere, but I couldn't find it. Thanks to everyone who even responds
Answer the question
In order to leave comments, you need to log in
Answer to your question:
https://stackoverflow.com/questions/10685893/run-e...
What is the purpose of opening it?
To run (if it's an exe) or to read it (or part of it)?
If you are such a beginner, then I advise you to read something on the topic, this elementary question is described in many textbooks. For example, there is a command
BufferedInputStream buf = new BufferedInputStream(new FileInputStream(file));
buf.read(bytes, 0, bytes.length);
buf.close();
Or like this, simpler: byte bytes[] = FileUtils.readFileToByteArray(file);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question