My physics teacher was famous for saying, "Everything technical is not difficult, and everything difficult is not technical." I chewed on that for years. I think what he meant was to look for easy ways to solve problems when it's the right thing to do. Files are just files. A short video tuutorial is enough. Make it easy on yourself, because non-technical challenges await. Take care
NOTE: if file.exists() always returns false, make sure to inclute /src before the name. For some reason java thinks that main.java is in the project folder when its actually in /src.
If I use the relative filename , the java can't find that txt file . There are 3 solutions 1) type "src\\message.txt" or "src/message.txt" . 2) Change the eclipse working directory to the absolute pathname of the folder (src) that contains your packages and txt file . By doing that , you can click section in top bar [Run] -> [Run Configurations] -> [Arguments] -> [Working directory] -> change from [Default] radio button to [Other] , enter your absolute pathname after [Other] -> [Apply] -> [Run] 3) type the absolute pathname .
So, as some people have already pointed out. Sometimes you need to enter the complete path for the file. You can see what that path is by right-clicking the file in the project tree and choose "Properties". Then copy all of that and use it instead of just the file name.
I find these videos so helpful. One problem I have with files though is when I make an installer for an application which allows a user to define where they want to install to, how can I set that file path then back in the application so it reads and writes to that file?
import java.io.File; public class Main { public static void main(String[] args){ File file = new File("song_lyrics.txt"); if(file.exists()){ System.out.println("That file exists! :O!"); System.out.println(file.getPath()); System.out.println(file.getAbsolutePath()); System.out.println(file.isFile()); file.delete(); } else{ System.out.println("File does not exist"); } } }
Hey i got a problem with my Intelidea that the program doesn't recognize the file for an unknown reason, showing on console that file doesn't exist... Only when i put full path, than all works fine..
I don't quite understand the file.delete part. Shouldn't the program every time you start it create a file (File file = new File("poem.txt");) , so eventually only the first condition of if statement (file.exists()) would be fulfilled. I know the file gets deleted by the end, but with another start of the program it is created again. So like, why every other start of the program ignores the File file = new File(); line.
Hello , i have a question please , i did all the instructions but it shows no file for some reason , why is that ? Edit: its ok comments already answered that , keep the great work man
Hello, I am developing android java filemanager app.. I used checkbox to check 1/file.mp4 2/folder(files+sub folders) . How can i add copy paste feature for checked 1, 2 file folder fully at same time ?like -google filemanager app.. Advance Thanks
We love seeing a file in his desktop saying nuclear launch codes 😂
bro 😂
💀
Hey bro, I just got a 97% on my final in my Java class and I wanted to say THANK YOU for helping to make that happen.
good work!
did you copy from google ?? xD
Congratulations! Onward you go!👏
My physics teacher was famous for saying, "Everything technical is not difficult, and everything difficult is not technical." I chewed on that for years. I think what he meant was to look for easy ways to solve problems when it's the right thing to do. Files are just files. A short video tuutorial is enough. Make it easy on yourself, because non-technical challenges await. Take care
This playlist was really helpful. You made it easy for us without consuming a huge amount of time.
What a useful programming video, and by a person who actually talks english!
Amazing.
import java.io.File;
public class Main {
public static void main(String[] args) {
// file = An abstract representation of file and directory pathnames
File file = new File("secret_message.txt");
if(file.exists()) {
System.out.println("That file exists! :O!");
System.out.println(file.getPath());
System.out.println(file.getAbsolutePath());
System.out.println(file.isFile());
file.delete();
}
else {
System.out.println("That file doesn't exist :(");
}
}
}
NOTE: if file.exists() always returns false, make sure to inclute /src before the name. For some reason java thinks that main.java is in the project folder when its actually in /src.
That just helps me
isn't it src/ and not /src?
@@WorstDruidEU yeah lol i was really confused for quite a bit
System.out.println("YOU ARE THE MAN, MAN!");
thank you so much
Awesome video, I love the way you explain new concepts
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
Thank you sir you are the most amazing teacher I've ever seen 👍
Nuclear launch codes 🤣 I had a good laugh now.
thanks very nice vid & explanation
Thank you for this very useful video!
If I use the relative filename , the java can't find that txt file .
There are 3 solutions
1) type "src\\message.txt" or "src/message.txt" .
2) Change the eclipse working directory to the absolute pathname of the folder (src) that contains your packages and txt file .
By doing that , you can click section in top bar [Run] -> [Run Configurations] -> [Arguments] -> [Working directory] -> change from [Default] radio button to [Other] , enter your absolute pathname after [Other] -> [Apply] -> [Run]
3) type the absolute pathname .
How do i find my absolute pathname??
@@flick4556 right-click the txt.file in eclipse -> [properties] -> location
I luv u
اقسم بالله عظمة !!
hey thanks bro.learnt a lot about File class..I subscribed
good one, nice video.
Hey, Thank you for the awsome learning experience... You've been a great help through my Java class this term. :)
thakyou so much for the videos
Short N Sweet
Cool! Easy to follow
Here's a prayer to the youtube algorithm. :D Thank you Bro Code for amazing videos!
Love your videos! Everything becomes so easy
nice video
Best UA-cam teacher ever
Waiting for DataStructure in java full Video , Please keep going, and thank You.
Thank you for all your work on these videos
You are just awesome 😎
Thank you Bro code !!! Appreciate your work man ... Keep up the good work .
nice
love your technique
bro
super
beautiful work my lord
Thanks Bro for this awesome videos, stop making Java easy to understand
Simply superb👍
thanks for watching Lakkoju!
Just the best
He is a legend,gamer+programmer
This helped more than you could understand, thank you!
WE back at it again, epic vid homie
let's gooooooooo
Thank you very much
I am loving with bro code for his coding content.
"Please excuse the mess".
Me:**starts breathing heavily knowing I have over 50+ files on my desktop**
super helpful, thanks bro
💪
Thanks
Thank you so much sir.
Thanks, Bro! ☕ You're awesome!
thanks
thank for this
So, as some people have already pointed out.
Sometimes you need to enter the complete path for the file.
You can see what that path is by right-clicking the file in the project tree and choose "Properties".
Then copy all of that and use it instead of just the file name.
That just helped me now😭😭. Thank you unknown helper 💗💗
Great!
keep the good work up brother
Bro I learn a lot from you thank you
Thanks bro.
sheiii bro
you are realy helpful bro. :)
😇❤
thank you bro
love the easter eggs
thanks! really well explained!
Thanks a lot!
Dude you are amazing!
I find these videos so helpful. One problem I have with files though is when I make an installer for an application which allows a user to define where they want to install to, how can I set that file path then back in the application so it reads and writes to that file?
nice video buddy...
Keep your text file outside your src folder incase if file.exists() always returns false...
Thanks.
import java.io.File;
public class Main
{
public static void main(String[] args){
File file = new File("song_lyrics.txt");
if(file.exists()){
System.out.println("That file exists! :O!");
System.out.println(file.getPath());
System.out.println(file.getAbsolutePath());
System.out.println(file.isFile());
file.delete();
}
else{
System.out.println("File does not exist");
}
}
}
Thanks! Cramming and my prof didn't cover this topic :/
thanks bro
Good video!!
best brooo
who can resist this thumbnail
Hey i got a problem with my Intelidea that the program doesn't recognize the file for an unknown reason, showing on console that file doesn't exist...
Only when i put full path, than all works fine..
yes it happens for me too! i'm using linux so maybe it has something to do with that..... idk
Amazing bro!
I love you bro
Bro i just want u to know; you re saving my ass ! thank u soo much !!!
Don't we have to close the file afterwards?
Thanks, Bro!
I don't quite understand the file.delete part. Shouldn't the program every time you start it create a file (File file = new File("poem.txt");) , so eventually only the first condition of if statement (file.exists()) would be fulfilled. I know the file gets deleted by the end, but with another start of the program it is created again. So like, why every other start of the program ignores the File file = new File(); line.
nice 2.0
Hello , i have a question please , i did all the instructions but it shows no file for some reason , why is that ?
Edit: its ok comments already answered that , keep the great work man
Hello,
I am developing android java filemanager app.. I used checkbox to check 1/file.mp4
2/folder(files+sub folders)
.
How can i add copy paste feature for checked 1, 2 file folder fully at same time ?like -google filemanager app..
Advance Thanks
4:38
I do have a file but it won’t full the array
Watch now
thank you, you are the best : >
best bro ever!
nuclear launch codes... 💀💀💀💀💀💀
i'm hungry
still hungry?
dude you live in my heart S2
Goat
Thank you bro, comment for the bro code
come on bro we want spring framework and spring boot
can i have the Nuclear launch codes pls AHAHAHA
EPIC
I click your ads bro !!
hey bro can you paste the code in the comment
Comment
Add a public comment...