So, my goal is to have a .desktop analyze it and start the program, the part where I extract the information from the .desktop I have already done, the problem is to start the applications, if I do
Desktop.getDesktop (). Open (file);
obviously it opens it to me with the system launcher, which I don't want, I wanted to know if there are any libraries that recognize the file and try to run it with the correct software (Appimage, jar and others are a problem, if not I could just do sh "path")
1 Answer 1
The .desktop file should point to a shell script which calls java on the needed application, or run java directly on the needed application (I guess it's a jar file).
java -classpath <classpath> -jar <path_to_your_jar>
3 Comments
file -i <your_file> in order to check the mimetype for the given file, then take an appropriate action for every mimetype (maybe a case statement in the bash script which decides with which application the file should be openened)Explore related questions
See similar questions with these tags.