I created a virus or what ? [ LOL ] - Printable Version +- Support Forums (https://www.supportforums.net) +-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87) +--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18) +---- Forum: Java Programming (https://www.supportforums.net/forumdisplay.php?fid=22) +---- Thread: I created a virus or what ? [ LOL ] (/showthread.php?tid=24944) |
I created a virus or what ? [ LOL ] - prince76 - 02-03-2012 Iam just a beginner in java and i have been working on my project which is some kind of "File System " and now one funny thing happened whenever iam writing to a file it erases all the text of the file and replaces it with the text written on the text area . try it -> Code: import java.util.*; copy the source code run it on netbeans/eclipse there will be a "TextArea" write anything on it like "blablabla". then click on the file menu -> then "save" you will get a savedialog box . Open any ".txt" file from your system then click on "save" . Close the program now check your .txt file your text will be replaced by the text you have just written on the textarea . the text wont be added it will replace the existing text . ok now wtf ? i just want to write it on the file rather than replacing the text what should i do please help me guys ! RE: I created a virus or what ? [ LOL ] - BreShiE - 02-03-2012 That's nothing like a virus, you can find the definition here; http://en.wikipedia.org/wiki/Virus But hey, it would be petty funny, yet pointless at the same time. Good luck on getting to your goal. RE: I created a virus or what ? [ LOL ] - prince76 - 02-03-2012 (02-03-2012, 02:48 PM)BreShiE Wrote: That's nothing like a virus, you can find the definition here; http://en.wikipedia.org/wiki/Virus Yeah I know its not a virus breshie bro common i dont need wikipedia for that . Its just like a funny virus and my goal is to remove this funny crap help me out please bro RE: I created a virus or what ? [ LOL ] - Denny Crane - 02-04-2012 When your java opens it, you havnt shown it how to create a new .txt file exactly the same. RE: I created a virus or what ? [ LOL ] - redpois0n - 03-22-2012 This is definitely not even near a virus. RE: I created a virus or what ? [ LOL ] - Alreiger - 03-22-2012 (02-03-2012, 02:48 PM)BreShiE Wrote: That's nothing like a virus, you can find the definition here; http://en.wikipedia.org/wiki/Virus It does however constitute as malware. "Malware, short for malicious software, is software designed to disrupt computer operation, gather sensitive information, or gain unauthorized access to computer systems. While it is sometimes software, it can also appear in the form of script or code. Malware is a general term used to describe any kind of software or code specifically designed to exploit a computer, or the data it contains, without consent. The expression is a general term used by computer professionals to mean a variety of forms of hostile, intrusive, or annoying software." RE: I created a virus or what ? [ LOL ] - Grin - 03-22-2012 Well... It just seems to run on someone else's computer. RE: I created a virus or what ? [ LOL ] - aHardyX - 03-24-2012 Haha. Its not a virus. Its a glitch in your programming. Firstly, the saving mechanism you stated above will obviously replace the text in the file. You need to open the file in your program and then make changes to it. Whenever you stream out data into a file through java, it will replace the whole file. But if you still want that method then do the following changes in your program. On clicking the "save" button on the Save dialog, use FileReader to read the existing lines in the text file. Store those into a string array. Then rewrite them into the file using FileWriter. Then take the text from the TextArea and write them into the using FileWriter again. That's it. If you still have problems with it just reply here. And do note that I get a NullPointerException at function loadFile(). Check that out too. Best of luck with the coding. And I just realized that this topic was bumped *sigh* RE: I created a virus or what ? [ LOL ] - redpois0n - 03-24-2012 (03-24-2012, 02:49 AM)aHardyX Wrote: Haha. Its not a virus. Its a glitch in your programming. Its hard for me to know, posts on the first page can be months old |