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
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in FILE
- Helpt with reading files
- Why can't I use the file pointer after the first read attempt fails?
- Can't read the file using std::wifstream C++
- How can the scanner reread the entire file after it has already executed hasNextLine once?
- What is 'Invalid Load Key, '\x00'
- php $_FILE variable undefined index
- Data loaded from the file is not returned in the correct order
- File splitting and encryption
- Optimizing an s5cmd command that uses awk to generate a text file
- segmentation fault while reading in text file ( c++ )
- File.OpenText is adding C:\ to the front which is an error
- UTF-8 issue with excel
- How to upload files to MediaWiki APIs in Rust?
- No such file or directory: '/tmp/tmp_ejr26m6.upload.mp3' in Django
- Problems accessing zip files on the react front end from express backend
Related Questions in FILEREADER
- Large file processing in the web browser
- Issue with File Upload using FileReader: "DomException: A requested file or directory could not be found at the time an operation was processed
- How do I extract the Base64 string from a FileReader (NextJs typescript)?
- Issues when Reading Preferences from Input File in Java for Stable Matching Problem
- How can I fetch metadata or file version (properties details section) of a file on client side?
- FileScanner does not have the next Line for Txt Files With First Few Lines Starting with Integers Concatenated with Strings
- FileReader() not working with Firefox and gib files
- Strange behavior with FileReader()
- "The requested file could not be read, typically due to permission problems..." - error message with FileReader in Angular App
- Where to put resources and access it in Java Project (in IntelliJ)? How to read from it then?
- how to get images to display on the browser using the fileReader() which returns the dataURL of the image
- after reading a file as text i can't remake a file from it
- How do i get the names of a files in a folder in React js
- How can I open a PDF file with FileReader and get the path?
- mirth file reader to read fhir-json content and replace few string
Related Questions in DEFAULT-PROGRAMS
- How do I create a powershell script to set default file type (.ica specifically) to open with a .exe located in C:\program files (x86)\
- wxLaunchDefaultApplication vs wxLaunchDefaultBrowser for opening a local directory in the default file manager
- How to add program into Control Panel Programs with C# or cmd
- Change default certificate manager for libreoffice
- Powershell script for set default associaltions/programs for all users on Windows 10
- How to simulate no browser installed under Windows
- Cant change default program for opening custom files
- How to set back the right default program for .vmoptions files?
- Visual Studio files association in Windows
- DISM /Import-DefaultAppAssociations runs successfully, but no file associations are changed
- Microsoft Windows7 show thumbnails conflicting with open with a default program
- How do I open a file in its default program by using the CLI in GitBash on Windows 7?
- Double clicking .txt files causes CMD to startup
- Polynomial Add: Unable to run code
- How to show "Set program associations" window in Windows 8/8.1?
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 # Hahtags
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?