T
T
Tarelka552022-02-15 14:50:14
Java
Tarelka55, 2022-02-15 14:50:14

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

2 answer(s)
O
Orkhan, 2022-02-15
Hasanly @azerphoenix

Answer to your question:
https://stackoverflow.com/questions/10685893/run-e...

A
AlexVWill, 2022-02-15
@AlexVWill

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 question

Ask a Question

731 491 924 answers to any question