• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to open text file in Executable Jar.

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created JAR file. Which is actually Text editor it works fine.

Now the problem is how to open .txt file by double clicking on Text file that so it'll open in my text editor.

Thanks in Advance.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That has little to do with your program but much more with your operation system. You must register it to associate a file type with your program. It's probably easier to use an installer which handles that for you.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It does have a little to do with your application. It must be able to handle command line arguments to pass the text file to open. You can use args[0] from the main method (if args.length > 0) as the file to open.

You then need to set up a file association which calls your application. The command would be That %1 is the first argument to the file association handler. You enclose it in double quotes so that your JVM will receive it as one command if the file name has spaces in it.
 
Vicky Thakor
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You ....i'm done it.....thanks a lot...
 
reply
    Bookmark Topic Watch Topic
  • New Topic