简体   繁体   中英

How to open .txt using windows explorer context menu in java swing?

I am making a text editor for.html, .CSS, .js, .txt etc. First I made my software in java swing and then I changed it to jar file then I changed it to exe file using launch4j and then I made it setup using innosetup but if I install this software and I right click on a file in windows explorer and choose open with and then I select my software and open it, it just open my software not the selected file so how to do it?

Windows will supply the path to the file as args[0] in your main method.

if(args.length > 0) {
    Path txt = Path.of(args[0]);
    //code to handle
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM