Click here to Skip to main content
16,014,677 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need the code for opening and reading a files with the java extension, the user must enter only a java file on the textbox to open the file.
Posted
Updated 19-Apr-12 1:02am
v2
Comments
Richard MacCutchan 19-Apr-12 7:54am    
Java files are source code so it is just the same as a text file. Look inside the file and you can easily see how to do it.
Sandeep Mewara 19-Apr-12 9:26am    
Here is what is expected by enquirers:
1. TRY first what you want to do!
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.

1 solution

You can use FileReader. Try this:

Java: Reading a File[^]

hope it helps :)
 
Share this answer
 
Comments
SandraCy 19-Apr-12 7:04am    
is'nt the file reader used for opening textfiles only?
TorstenH. 19-Apr-12 8:08am    
a java source file with the extension *.java is basically text file.
A *.jar file is a compiled file and should not be read - therefor is a source provided if open source.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900