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.
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"); } } }
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?
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 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
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
Yo just wanna say that GOD loved the world so much he sent his only begotten son Jesus to die a brutal death for us so that we can have eternal life and we can all accept this amazing gift this by simply believing in him (Jesus) asking for the forgiveness of your sins and forming a relationship with heavenly father.
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 :(");
}
}
}
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
We love seeing a file in his desktop saying nuclear launch codes 😂
bro 😂
💀
This playlist was really helpful. You made it easy for us without consuming a huge amount of time.
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
What a useful programming video, and by a person who actually talks english!
Amazing.
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
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
WE back at it again, epic vid homie
let's gooooooooo
Awesome video, I love the way you explain new concepts
Thank you sir you are the most amazing teacher I've ever seen 👍
hey thanks bro.learnt a lot about File class..I subscribed
Hey, Thank you for the awsome learning experience... You've been a great help through my Java class this term. :)
Thank you for this very useful video!
Nuclear launch codes 🤣 I had a good laugh now.
اقسم بالله عظمة !!
thanks very nice vid & explanation
Thank you Bro code !!! Appreciate your work man ... Keep up the good work .
Here's a prayer to the youtube algorithm. :D Thank you Bro Code for amazing videos!
Waiting for DataStructure in java full Video , Please keep going, and thank You.
Love your videos! Everything becomes so easy
Thanks Bro for this awesome videos, stop making Java easy to understand
This helped more than you could understand, thank you!
Cool! Easy to follow
good one, nice video.
love your technique
bro
Best TH-cam teacher ever
Thank you for all your work on these videos
super helpful, thanks bro
thakyou so much for the videos
beautiful work my lord
I am loving with bro code for his coding content.
Dude you are amazing!
you are realy helpful bro. :)
You are just awesome 😎
Thanks, Bro! ☕ You're awesome!
"Please excuse the mess".
Me:**starts breathing heavily knowing I have over 50+ files on my desktop**
keep the good work up brother
Bro I learn a lot from you thank you
He is a legend,gamer+programmer
Thank you very much
Simply superb👍
thanks for watching Lakkoju!
Thank you so much sir.
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 💗💗
thanks! really well explained!
nice video
Just the best
Thanks! Cramming and my prof didn't cover this topic :/
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");
}
}
}
nice video buddy...
Thanks bro.
Short N Sweet
Keep your text file outside your src folder incase if file.exists() always returns false...
Thanks.
thank you bro
Good video!!
Amazing bro!
Thanks a lot!
super
thank for this
nice
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?
Thanks
love the easter eggs
thank you, you are the best : >
thanks
sheiii bro
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
I love you bro
Great!
best bro ever!
💪
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.
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
Thanks, Bro!
Watch now
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
best brooo
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?
dude you live in my heart S2
😇❤
who can resist this thumbnail
4:38
I do have a file but it won’t full the array
Goat
Thank you bro, comment for the bro code
nice 2.0
EPIC
come on bro we want spring framework and spring boot
can i have the Nuclear launch codes pls AHAHAHA
i'm hungry
still hungry?
nuclear launch codes... 💀💀💀💀💀💀
hey bro can you paste the code in the comment
Yo just wanna say that GOD loved the world so much he sent his only begotten
son Jesus to die a brutal death for us so that we can have eternal life
and we can all accept this amazing gift this by simply believing in him (Jesus) asking for the forgiveness of your sins
and forming a relationship with heavenly father.
I click your ads bro !!
"NUCLEAR LAUNCH CODES" XDDDDDDDDDDDD
i wanna know what the fuck exactly resides in that XDDDDDDDDDDDDDDD