I do something wrong when I try to create a file.
I work with binary files, try to make a log file and I get this errorjava.io.FileNotFoundException: log.dat (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at Servidor.XServer.log(XServer.java:186)
at Servidor.XServer$nwc$readLine.run(XServer.java:312)
This is because the file is not created, but I do not know why, here is my code, I try to create. /// ANADIR EVENTOS AL ARCHIVO LOG // ADD EVENTS TO LOG FILE
int log(String arg[], String ip , String voto){
File file = null;
if (file == null) {
System.out.println ("Default: log.dat");
file = new File ("log.dat"); // why it isn't creating the file?
}
// Now write the data to the file.
try{
FileInputStream file_input = new FileInputStream (file);
DataInputStream data_in = new DataInputStream (file_input);
String iptmp =""; // ip tmp
String vot1=null; // vot 1er lugar tmp
String vot2=null; // vot 2do lugar
int itmp=0; // intentos tmp
while(true){
try{
iptmp= data_in.readUTF();
vot1= data_in.readUTF();
vot2=data_in.readUTF();
itmp=data_in.readInt();
DataOutputStream data_out = new DataOutputStream (new FileOutputStream (file));
voto=(voto.substring(0, 1)+chart.get(Integer.parseInt(voto.substring(1, voto.length()))));
// SI EL IP YA VOTO POR EL PRIMER EQUIPO (ERROR EN VOTO)
if (iptmp.equalsIgnoreCase(ip) && vot1!=null && voto.startsWith("1")){
data_out.writeInt(itmp+1);
return(-1);
}
// SI EL IP YA VOTO POR EL SEGUNDO EQUIPO (ERROR EN VOTO)
if (iptmp.equalsIgnoreCase(ip) && vot2!=null && voto.startsWith("2")){
data_out.writeInt(itmp+1);
return(-1);
}
// SI UN IP NO HA VOTADO POR EL PRIMER LUGAR
if (iptmp.equalsIgnoreCase(ip) && vot1==null && voto.startsWith("1")){
data_out.writeChars(ip); // ip
data_out.writeChars(voto); // voto por primer lugar
data_out.writeInt(itmp); // intentos de votos
}
// SI UN IP NO HA VOTADO POR EL SEGUNDO LUGAR
if(iptmp.equalsIgnoreCase(ip) && vot2==null && voto.startsWith("2")){
data_out.writeChars(ip); // ip
data_out.writeChars(voto); // voto por segundo lugar
data_out.writeInt(itmp); // intentos de votos
}
data_out.close();
}catch (EOFException eof) {
System.out.println ("End of File");
break;
}
data_in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
return 0;
}
Could you help me with this? I don't see what the problem is I'm following the example of the oracle / java tutorial and I can't see what is different
Adolfo R. says:
/// ANADIR EVENTOS AL ARCHIVO LOG // ADD EVENTS TO LOG FILE file = new File ("log.dat"); // why it isn't creating the file?
Could you help me with this? I don't see what the problem is I'm following the example of the oracle / java tutorial and I can't see what is different
A file object is the path pointing to something on a file system. That something does not exist and create the file is not created automatically (how it whether to create a file or folder?).
To check if it exists, file.exists (of use) and you might also want to check isFile(). They're not together, you cannot read him.
Also, you have to at least close the stream a finally block. You seem to close the stream after the first loop, and then try to re-read so ><>
Tags: Java
Similar Questions
-
I am hving wrong when I try to sync (Tungsten E2) to my computer. My computer has Windows 7. Anyone know a solution for this problem?
Probably, the problem is that you have a 64-bit version of Win7.
At the top of the list of the messages in this section, you will find a title "64-bit Windows USB drivers for Palm Desktop."
Please read this post and follow the directions to install the drivers of the company Aceeca.
WyreNut
-
Siri: "sorry, there is something wrong. Please try again. »
Whenever I ask Siri play a playlist of music, to play a station of Podcasts to create a reminder, etc, etc, she invariably responds: "sorry, [my name], there is something wrong." Please try again. "Verification of the work of sports scores. Audit of the work of the stock indices. But it seems that any request fails if it comes to interact with any Apple application.
This seems to be a problem with siri is not able to do some cloud connection it takes to really work, a turned network reset everything back to normal, by restarting and running as the most recent update made no difference
-
Hi everyone, auggy,
I really hope you can help me with a problem I have on a single workstation at my office. It is an accumulation of 32-bit Windows 7 running MS Office 2010 Standard. It differs from other generations in our office because it is used by the head of the team of our accounts, and so it has a number of custom pieces of software that she only needs access (payroll software, etc.).
All the basic features of the computers seem to be well, except the two following, and I would really like to help get to the bottom of it.
(1) process explorer error when you try to browse the files and folders of BES.
I can call Windows Explorer absolutely perfect and be sailing away on his machine, and then suddenly the process explore will die, with the following error: -.
Signature of the problem:
Problem event name: BEX
Application name: explorer.exe
Application version: 6.1.7601.17567
Application timestamp: 4d6727a7
Fault Module name: StackHash_0a9e
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception offset: 03e2f944
Exception code: c0000005
Exception data: 00000008
OS version: 6.1.7601.2.1.0.256.48
Locale ID: 2057
Additional information 1: 0a9e
More information 2: 0a9e372d3b4ad19135b953a78882e789
Additional information 3: 0a9e
Additional information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.Microsoft.com/fwlink/?LinkId=104288&clcid=0x0409
If the online privacy statement is not available, please read our offline privacy statement:
C:\Windows\system32\en-US\erofflps.txt
I can start windows Explorer, and it will happen again--it's a repetitive event.
(2) Internet Explorer AppHangB1 when you try to attach files to download
I think that these two errors may actually be related, like IE (and Chrome as well by the way, this be why I think that the two issues are related) works fine, until I just any type of site where I need to download a file. This happened in the light, as our Chief of accounts needs to download a flat file in a room online banking software. What's going to happen (and, again, this can be repeated as needed) is: -.
(a) you need to click on which will generally be a "Browse" button
(b) a traditional dialog box opens, but instead which allows you to navigate to the location and select the folder you want, he immediately greys out as if the process explore is falling.
(c) shortly after, the following error is returned: -.
Description:
A problem caused this program blocking interact with Windows.
Signature of the problem:
Problem event name: AppHangB1
Application name: iexplore.exe
Application version: 11.0.9600.16521
Application timestamp: 53114399
Hang Signature: ffae
Hang Type: 513
OS version: 6.1.7601.2.1.0.256.48
Locale ID: 2057
Signing of additional blocking 1: ffaeadd6649c2780023c6d9ea230850d
Signing of additional blocking 2: e32d
Signing of additional blocking 3: e32d1064528f9bd1cbe46cdd0db7b0f1
Signature of blocking additional 4:0498
Signing of additional blocking 5: 0498e046eb6db4d68a7cd9b11dab2644
Signing of additional blocking 6: effb
Signing of additional blocking 7: effb796b5c1ff7f6708d2722fa7c24bd
Read our privacy statement online:
http://go.Microsoft.com/fwlink/?LinkId=104288&clcid=0x0409
If the online privacy statement is not available, please read our offline privacy statement:
C:\Windows\system32\en-US\erofflps.txt
On auggy recommendation, I've set up a registry key insert that returns the explorer.exe hangs in a dump file, and I am trying to load two reports on SkyDrive - I'll post the URL in this thread as soon as I finished it.
Can someone help me please?
Thank you very much!!
David.
Hi auggy, Andy,.
Well... in a way, I am very disappointed, but we will respond to it.
Andy, I checked and iCloud, Control Panel has not been installed on its terminal, but thank you very much for suggesting it :)
auggi, when I got back on my colleague's PC, I thought I would test to see if the feature didn't always before considering saving data dumps etc, and it worked fine!
I left it overnight with instructions for the lady who uses the PC to test this morning and see if it's all workers, and it is still, it seems that the fix does not immediately solve the problem of browser, but there later - maybe after a second reboot or something... very strange!
In all case, this matter can now be considered closed, so all that remains for me to say thank you very much for your help, you are amazing :)
All the best, very, very,.
David.
-
When I try to create an account, I get a: = 403 Forbidden error
I'm setting up eprint for my new Oggicejet HP 6700 Premium. When I try to create an account, I get the error of the object (403). What I am doing wrong?
Hello
Please try another web browser, OR clear all the cache, history and cookies, then try again.
Kind regards.
-
I have several pdf documents created using a form to fill out. When I try to create a combined PDF information either is removed from all pages after the first page or all the pages after the fact look page 1 as duplicate page 1. what I am doing wrong?
The problem is that these files have fields with the same name in them, thus
When you merge them they become copies of each other and of all their
the values are the same.
To avoid it you must either rename the fields before you merge the files
or flatten, converting them to static content.
The game, March 24, 2016 at 22:00, peggyp13342216, [email protected]>
-
Error no valid identifier when you try to create a trigger
Hi all
I get this weird error when you try to create a trigger. Basically, it updates a table of different relationship on INSERT or UPDATE.
The error I get is:
* PL/SQL: ORA-00904: "cid": invalid identifier *.
The column exists and matches the data type (number). Any help appreciated. bit at loss where I'm wrong.SET SERVEROUTPUT ON CREATE or REPLACE TRIGGER UPDATE_REL_TABLE AFTER INSERT OR UPDATE ON XF_PROJECT_CODE FOR EACH ROW DECLARE customer_count NUMBER; n_cid NUMBER; BEGIN -- CHECK if company exist SELECT COUNT(*) INTO customer_count FROM XF_CLIENTS WHERE UPPER(client_name) = UPPER(:NEW.company); CASE WHEN customer_count > 0 THEN -- GET CUSTOMER ID select t.cid INTO n_cid FROM XF_CLIENTS t WHERE t.CLIENT_NAME = :NEW.company; // ERROR HERE!! -- UPDATE relationship table INSERT INTO XF_CLIENT_CODE_R (PROJECT_CODE_ID, cid) VALUES (:NEW.project_code_id, n_cid); ELSE -- customer does not exist n_cid := XF_CLIENTS_SEQ.NEXTVAL; -- Create client INSERT INTO XF_CLIENTS(cid, client_name) VALUES(n_cid, :NEW.company); -- update relationship table INSERT INTO XF_CLIENT_CODE_R(project_code_id, XF_cid) VALUES (:NEW.project_code_id, n_cid); END CASE; END; / SHOW ERRORS;
Good fishing! Who'd do all right.
-
42 error code when you try to delete the file
PDF file which can be opened and read. However, when you try to delete the file, error file not found 42 made its appearance. MacBook Pro computer
Please relaunch the Finder , and then try again. If there is no change, restart the computer.
-
Firefox crashes when you try to attach a file to gmail compose
Laptop Vista 32. When you try to attach a file to a gmail account, compose explore dialog and then firefox crashes. Happens every time and began (I think) with the 16 or 17 years old version. Updated plugins, crossed of troubleshooting on the Help menu, I tried safe mode. All to nothing does not. IE works fine.
After reviewing all services and startup programs using msconfig, I've isolated the problem to a conflict with Dell Media Center in starting. I deleted the software (preinstalled on your laptop) since I never use anyway, re-enabled the acceleration hardware Flash and deleted the line mode protected in the file flash cfg.
NO MORE CRASHES when you try to attach a file to a message in gmail!
Thanks for all your help - could not have corrected it without you.
-
Error message when I try to create or reproduce a numbers document.
When I try to create or reproduce a numbers document, I get the following error message:
'Untitled.numbers' could not be moved, because you don't have the permission to access the 'Documents '. To view or change permissions, select the item in the Finder and choose file > read the information.
So far, I have never had a problem creating or duplicating a numbers document. I don't understand why I get this error. Can someone please help me fix this so that I do not continue to have this problem. Please note that documents Pages works fine.
Hi stelcon,
I see that you encounter some problems with the permissions on your Mac running El Capitan. I have two articles for you who will guide you through the following steps to resolve this problem:
Set permissions for the items on your Mac OS X El Capitan:
https://support.Apple.com/kb/PH21997
OS X El Capitan: If you do not have permissions to open a file or folder
https://support.Apple.com/kb/PH22196
Thank you for coming to Apple Support communities!
-
Satellite U205-S5034 - error when you try to create the recovery disks
Hello world
I have problems with the TOSHIBA recovery disk creator. When you try to create the recovery disks this error pops up:
An unexpected error has occurred. Exit this application and start it again. (Error code: F1-0F00FE-00000002)The machine is a Satellite U205-S5034 under XP Pro SP3.
Any help will be greatly appreciated. Thank you and have a nice day.
DaveMatt44
Hello
What kind of DVD that you use to create a Toshiba Recovery disk? I have tried Verbatim DVD-R and TDK DVD-R and never had a problem with these discs. A friend tried DVD + R and he couldn t create a recovery disk. After he tried DVD-R and everything was fine but I do not know why this happened.
So please try other discs.Also, check the Toshiba page for an update of the firmware of the CD/DVD drive. Maybe it will help you.
-
Photo Story 3 impossible to join several video (audio) to program songs that has been created, an error message that it cannot accept the format audio, even when you try to select the files mp3 audio.
Hi BeverlyHeuer,
I suggest that you convert the music file to convert it into .wav format and check if you can contact.
Photo Story 3 for Windows: frequently asked questions
http://Windows.Microsoft.com/en-us/Windows-XP/help/digitalphotography/photo-story-FAQ
-
When you try to transfer a file of 8 GB on external hard drive 'file too large for the destination system message' to get there is that much space on disk
Hello
Discs formatted with the FAT be limited to files with a maximum of 4 GB. You can format outside
drive drive with NTFS, contact the manufacturer if necessary pilot or split the file into parts under
at 4 GB.Overview of FAT, HPFS, and NTFS file systems
http://support.Microsoft.com/kb/100108How to go beyond the limit of 4 GB on FAT32
http://lazybit.com/index.php/2007/03/01/how_to_get_over_the_4gb_limit_fat32-------------------------------------------------------------------------------------------------------------------------
The ZIP file and then divided the ZIP which helps maintain the integrity of sharing files and restoring.
Zip and Split - free
http://zipandsplit.toolazy.me.UK/Split and Zip - free
http://www.jtoolgame.com/tools/splitzip.htmlAkhir Split Zip - free
http://www.mydigitallife.info/2009/04/24/Akhir-split-zip-splits-files-into-smaller-zip-files/I hope this helps.
Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="">-><- mark="" twain="" said="" it="">->
-
Original title: I can not burn CD
I can down load soft ware, playing CDs; s & DVD, but when I try to burn a file to a CD, the system does not recognize that I have a CD in D drive. How to fix this?
Hello
1. have you tried using different CD and check?
2. were you able to burn CDs without any problem earlier?
3. have you made changes on the computer before this problem?The hotfix in the following article might help you.
Your CD or DVD drive cannot read or write media
http://support.Microsoft.com/mats/cd_dvd_drive_problems/ -
Original title: WINZIP HELP
I have windows professional xp and when I try to attach a file to an e-mail or even see where I saved them they do not appear. I'm looking for all THE files, but no zipped files are there. Help, please!
Hello
1. What mail client do you use?
I suggest you to check if the files are hidden:
Also check out this link:
http://support.Microsoft.com/kb/306531
It will be useful.
Maybe you are looking for
-
Hello First of all, sorry for my bad English is not my mother tongue. I have a MacBook Pro (late 2011, i7 2, 2 GHz, 320GB HD, 4 GB RAM, Radeon HD 6750 M 512 MB, OS X El Capitan) and I tried to install Windows via Bootcamp 8.1. I changed the info.plis
-
Hello My drops of laptop down like 2 times a day. It happens when the computer is busy, as if I'm playing games. I think it's because my laptop gets hot, but how can I see if it is true? I am able to see the cause of this problem somewhere? Everest s
-
I pre-ordered the new Bloc Party, set to be released on 29/01/16 and I was wondering if my debit card was charged the full amount yet?
-
6.5.1 OS upgrade OS 4 - default password problem (Ultra 6)
I installed my OS 6.5.1 6 Ultra and I'm having a problem accessing the Admin page. In the lower left corner of the RADar is a box that reads, "Offline Setup (LAN). I click on that and get the standard connection to the screen. I have keyed "admin" as
-
Read a list of variables shared remotely
I asked this question yesterday and I'll try again today. How can I read in my LV program a list of available shared variables that reside on another PC? This morning, I realized that if I go into the Manager of distributed system, I find a list of