3

how can I open a file from within a java program with a custom application?

Desktop.getDesktop().open(file);

opens the file only with the systems default application. What I need is something like

open(myapp, file);
0

1 Answer 1

3

If the target application accepts files to open as arguments, then you could do the following:

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("CustomApp "+filename);
Sign up to request clarification or add additional context in comments.

2 Comments

seems to be working, but I get the error cannot run program: ... error 13 permission denied
@EikeCochu Glad it worked. Make sure you have the proper rights to run the application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.