I am coding a JAVA reader to read .txt files as a substitution for notepad. Now, the problem is, I want to set that program to be the default program to open all .txt files. Now, how the program will distinguish which file I am opening via the program? I don't want to make a program that will first open JFileChooser and will make the user to open that file via JFileChooser. I just want to make a notepad in java that will open .txt files like notepad does. When I will click on a file say, *.txt, it will use my program to open that file and my program will show the chars of that file.
Making a default reader to open all files of a fixed extention (e.g. *.txt)
186 Views Asked by iMagur At
2
There are 2 best solutions below
3
smalltown2k
On
Surely the issue here is making Windows/OSX/Linux register your program as the default which presumably has to happen outside the confines of your program?
You can do an "Open with..." on Windows/Mac (not sure on Linux) and just use your program instead. Your program then could take the file name as the command line argument and do with it what you want.
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in FILE
- Saving FileSystemInfo Array to File
- C programming: Create and write 2D array of files as function
- How can I change a specific line in a file with node js?
- Grabbing Edits from two strings
- In Android, would it be possible to open a file in the 'values' folder and to read its content?
- Using paths bonded to a XCode project to be shared
- Why am i getting these invalid characters before my file data?
- Optimum directory structure for large number of files to display on a page
- C Reading binary file with fread()
- Renaming a File() object in JavaScript
- How to write the current time to a new line of a .txt file on php execution
- introduce c++ into html
- How can I create a simple text file on a windows phone (8.1) that can be accessed trough USB cable?
- Pop-up and download zip file in ASP.NET
- Using access() in C
Related Questions in FILEREADER
- Loading binary image data to an image fails on Android 4.1 in Cordova Project
- How to read specific patterns with FileReader in Java
- FileReader.readAsDataURL not working for some file types in IE10
- How can I use filereader to parse csv file and convert it into an array?
- jQuery each + FileReader not returning correct values
- Can the ouput of a HTML5 FileReader.readAsDataURL be used to reference fonts?
- Chrome App FileReader
- How to deserialize an uploaded font from a Base64String?
- Having issue reading a file from directory
- Dealing with FileReader and subString
- How to skip an Empty line while reading a file (java)?
- Java: BufferedReader Keeps Writing Values 128-159 as 63 When Converting to Char
- How to read .txt or .doc file in codeigniter?
- Javascript testing with mocha the html5 file api?
- Link vector element in Clojure
Related Questions in DEFAULT-PROGRAMS
- How to programmatically determine default applications in linux
- Change Default Program for .jar File
- How to enable quick edits from file manager in PhpStorm after install
- Cant change default program for opening custom files
- How come processStartInfo doesn't work
- get default Windows text editor .exe path using c++
- In Obj-C, how to programmatically set the default "open with" property of a file in Mac OS X
- Visual Studio files association in Windows
- How to set back the right default program for .vmoptions files?
- Windows Vista, Default Programs API, file format associations, and (un)installers - explosive mix!
- 'How do you want to open' 8.1 dialog and icons
- DISM /Import-DefaultAppAssociations runs successfully, but no file associations are changed
- wxLaunchDefaultApplication vs wxLaunchDefaultBrowser for opening a local directory in the default file manager
- Change default certificate manager for libreoffice
- Make our application show in access and defaults
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I didn't test it, but I would expect that if you create a Jar file from your sources, and you let your OS point to that file to open *.txt files, then the absolute path of the file to open would be in your main's "String[] args". Can you make a quick test?