Thread View: borland.public.jbuilder.java.language
9 messages
9 total messages
Started by Magnus
Wed, 15 Jun 2005 22:18
Printwriter outside JBuilder
Author: Magnus
Date: Wed, 15 Jun 2005 22:18
Date: Wed, 15 Jun 2005 22:18
26 lines
1792 bytes
1792 bytes
Hi,
Within JBuilder developing and testing I had the following:
logFile = new PrintWriter(new FileWriter("./logs/"+filename,true));
This worked great and all logs were created and all in my "logs" directory.
Now, copy my jar, db files, etc. to a new directory (test-dir) and my
app sometimes just hang ... I noticed it when trying to read the serial
port since I log what I read. I could not figure it out until I tested
to print a log before and after my init of the reading process. Nothing
is printed.
Just to test I change the line to:
logFile = new PrintWriter(new
FileWriter("F:/MyTestDir/TesData/"+filename,true));
And now it works like a charm ...
Why would I need an absolute path outside JBUilder but not within?
As always, I'm grateful for any and all help.
Magnus
Re: Printwriter outside JBuilder
Author: Alexey N. Solofnenko
Date: Wed, 15 Jun 2005 22:36
Date: Wed, 15 Jun 2005 22:36
38 lines
2099 bytes
2099 bytes
PrintWriter masks all exceptions, so maybe your program is still
running, but the logging has stopped. It can happen, if your local hard
drive is out of space, but disk F: has plenty of space.
- Alexey.
Magnus wrote:
> Hi,
>
> Within JBuilder developing and testing I had the following:
>
> logFile = new PrintWriter(new FileWriter("./logs/"+filename,true));
>
> This worked great and all logs were created and all in my "logs" directory.
>
> Now, copy my jar, db files, etc. to a new directory (test-dir) and my
> app sometimes just hang ... I noticed it when trying to read the serial
> port since I log what I read. I could not figure it out until I tested
> to print a log before and after my init of the reading process. Nothing
> is printed.
>
> Just to test I change the line to:
>
> logFile = new PrintWriter(new
> FileWriter("F:/MyTestDir/TesData/"+filename,true));
>
> And now it works like a charm ...
>
> Why would I need an absolute path outside JBUilder but not within?
>
> As always, I'm grateful for any and all help.
>
> Magnus
>
--
Alexey N. Solofnenko {trelony at gmail.com}
home: http://trelony.cjb.net/
Re: Printwriter outside JBuilder
Author: Magnus
Date: Thu, 16 Jun 2005 01:25
Date: Thu, 16 Jun 2005 01:25
46 lines
2493 bytes
2493 bytes
Everything is on my WinXP PC (I have multiple partitions) and I have
about 100GB left.
The program stopped and I even tried to print a one line logg when
clicking on a button. Nothing was printed in the log until I put the
absolute path ...
Alexey N. Solofnenko wrote:
> PrintWriter masks all exceptions, so maybe your program is still
> running, but the logging has stopped. It can happen, if your local hard
> drive is out of space, but disk F: has plenty of space.
>
> - Alexey.
>
> Magnus wrote:
>
>> Hi,
>>
>> Within JBuilder developing and testing I had the following:
>>
>> logFile = new PrintWriter(new FileWriter("./logs/"+filename,true));
>>
>> This worked great and all logs were created and all in my "logs"
>> directory.
>>
>> Now, copy my jar, db files, etc. to a new directory (test-dir) and my
>> app sometimes just hang ... I noticed it when trying to read the
>> serial port since I log what I read. I could not figure it out until I
>> tested to print a log before and after my init of the reading process.
>> Nothing is printed.
>>
>> Just to test I change the line to:
>>
>> logFile = new PrintWriter(new
>> FileWriter("F:/MyTestDir/TesData/"+filename,true));
>>
>> And now it works like a charm ...
>>
>> Why would I need an absolute path outside JBUilder but not within?
>>
>> As always, I'm grateful for any and all help.
>>
>> Magnus
>>
>
Re: Printwriter outside JBuilder
Author: Lori M Olson [TeamB]
Date: Thu, 16 Jun 2005 15:57
Date: Thu, 16 Jun 2005 15:57
30 lines
2045 bytes
2045 bytes
Magnus wrote:
>>> Now, copy my jar, db files, etc. to a new directory (test-dir) and my
>>> app sometimes just hang ... I noticed it when trying to read the
>>> serial port since I log what I read. I could not figure it out until
>>> I tested to print a log before and after my init of the reading
>>> process. Nothing is printed.
>>>
You did not mention exactly how your are invoking your application when
you run it outside JBuilder. How you do this will affect the "current
working directory", which is how relative path references are resolved.
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Re: Printwriter outside JBuilder
Author: Magnus
Date: Thu, 16 Jun 2005 20:32
Date: Thu, 16 Jun 2005 20:32
21 lines
2069 bytes
2069 bytes
Right now I create a bat-file in the same dir as my jar-file. --- bat file --- javaw -classpath ".\classes\jdsserver.jar;.\classes\comm.jar;.\MYAPP.jar" myapp.MYAPP --- end --- Lori M Olson [TeamB] wrote: > Magnus wrote: > >>>> Now, copy my jar, db files, etc. to a new directory (test-dir) and >>>> my app sometimes just hang ... I noticed it when trying to read the >>>> serial port since I log what I read. I could not figure it out until >>>> I tested to print a log before and after my init of the reading >>>> process. Nothing is printed. >>>> > > You did not mention exactly how your are invoking your application when > you run it outside JBuilder. How you do this will affect the "current > working directory", which is how relative path references are resolved. >
Re: Printwriter outside JBuilder
Author: Magnus
Date: Tue, 21 Jun 2005 14:44
Date: Tue, 21 Jun 2005 14:44
27 lines
2128 bytes
2128 bytes
I have just installed JBuilder 2005 Professional and now I can't use "./logdir/filename" inside JBuilder either ??? Magnus wrote: > Right now I create a bat-file in the same dir as my jar-file. > --- bat file --- > javaw -classpath > ".\classes\jdsserver.jar;.\classes\comm.jar;.\MYAPP.jar" myapp.MYAPP > --- end --- > > Lori M Olson [TeamB] wrote: > >> Magnus wrote: >> >>>>> Now, copy my jar, db files, etc. to a new directory (test-dir) and >>>>> my app sometimes just hang ... I noticed it when trying to read the >>>>> serial port since I log what I read. I could not figure it out >>>>> until I tested to print a log before and after my init of the >>>>> reading process. Nothing is printed. >>>>> >> >> You did not mention exactly how your are invoking your application >> when you run it outside JBuilder. How you do this will affect the >> "current working directory", which is how relative path references are >> resolved. >>
Re: Printwriter outside JBuilder
Author: Alexey N. Solofnenko
Date: Tue, 21 Jun 2005 17:00
Date: Tue, 21 Jun 2005 17:00
13 lines
1572 bytes
1572 bytes
The current folder depends on your project configuration. Try printing
new File("./logdir/filename").getAbsolutePath() and see what is there
and why there can be a problem.
- Alexey.
Magnus wrote:
> I have just installed JBuilder 2005 Professional and now I can't use
> "./logdir/filename" inside JBuilder either ???
>
--
Alexey N. Solofnenko {trelony at gmail.com}
home: http://trelony.cjb.net/
Re: Printwriter outside JBuilder
Author: Magnus
Date: Tue, 21 Jun 2005 19:08
Date: Tue, 21 Jun 2005 19:08
34 lines
2456 bytes
2456 bytes
OK! That worked for most of the "logs".
I still have problem (that used to work?) when I call the constructor
for my SerialPortCommunication class. Here I log what is sent to and
read from the COMPORT. Now I get:
---
java.io.FileNotFoundException: F:\jbproject\APP\port\log.txt (The system
cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at java.io.FileWriter.<init>(FileWriter.java:46)
...
---
I tried to create the file so I know it is there but same error. It
seems like this thread don't know how to create, or open a file.
I noticed in WinXP that the property "read-only" was checked and gray
but that goes for all log directories where I can write as well.
Alexey N. Solofnenko wrote:
> The current folder depends on your project configuration. Try printing
> new File("./logdir/filename").getAbsolutePath() and see what is there
> and why there can be a problem.
>
> - Alexey.
>
> Magnus wrote:
>
>> I have just installed JBuilder 2005 Professional and now I can't use
>> "./logdir/filename" inside JBuilder either ???
>>
Re: Printwriter outside JBuilder - ignore last input
Author: Magnus
Date: Tue, 21 Jun 2005 20:23
Date: Tue, 21 Jun 2005 20:23
43 lines
2872 bytes
2872 bytes
The last test was caused by me. While testing the absolute path I missed
a character in the port path... I even thought I did a cut from Explorer
and paste into my code to make sure I got the correct path but I
probably missed it anyway.
It is as they say, the devil is in the details ;)
Magnus wrote:
> OK! That worked for most of the "logs".
>
> I still have problem (that used to work?) when I call the constructor
> for my SerialPortCommunication class. Here I log what is sent to and
> read from the COMPORT. Now I get:
> ---
> java.io.FileNotFoundException: F:\jbproject\APP\port\log.txt (The system
> cannot find the path specified)
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
> at java.io.FileWriter.<init>(FileWriter.java:46)
> ...
> ---
>
> I tried to create the file so I know it is there but same error. It
> seems like this thread don't know how to create, or open a file.
>
> I noticed in WinXP that the property "read-only" was checked and gray
> but that goes for all log directories where I can write as well.
>
> Alexey N. Solofnenko wrote:
>
>> The current folder depends on your project configuration. Try printing
>> new File("./logdir/filename").getAbsolutePath() and see what is there
>> and why there can be a problem.
>>
>> - Alexey.
>>
>> Magnus wrote:
>>
>>> I have just installed JBuilder 2005 Professional and now I can't use
>>> "./logdir/filename" inside JBuilder either ???
>>>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads