You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Michael McGrady <mi...@michaelmcgrady.com> on 2004/10/14 09:16:07 UTC

java.io.tempdir Problems

I hope this is Tomcat related.  If not, please accept my apologies, and 
give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a 
custom taglib) service the java.io.tempdir setting because when I use 
the following code:

     File file = new File(Classpath.WEB_INF +
                     "resource"        + File.separator +
                     "content_type"    + File.separator +
                     "ttf"             + File.separator +
                      physicalName);
     FileInputStream fontStream = new FileInputStream(file);
     Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
     font = font.deriveFont(attributes);
     fontStream.close();

I get temp files of around 50 - 150 kilobytes each written to the temp 
directory.  I requested assistance on Tomcat User without an answer. 

Anyway, I assume that there may be a concurrency issue of somekind.  Is 
that right?  Anyone with any assistance out there?

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


[Off-Topic] Re: java.io.tempdir Problems

Posted by Paul Speed <ps...@progeeks.com>.
It sounds like maybe there is some confusion between environment 
variables and system properties.

java.io.tempdir is a system property which presumably means it can be 
set on the Java command line using -Djava.io.tempdir="foo"

This is different then anything getenv() would return since those would 
be environment variables.  Some of which are reflected as differently 
named system properties.  For example, I think java.io.tempdir defaults 
to the TEMP environment variable under Windows and perhaps TMP under 
Unix or something like that.  I'd have to drill into javadocs to be sure.

-Paul

Michael McGrady wrote:

> I don't know if this is helpful or not, Martin, but if you attempt 
> System.getenv("java.io.tempdir") [which is deprecated], you get as part 
> of the error message
> "getenv no longer supported, use properties and -D instead: 
> java.io.tempdir".  Is that helpful?  Does the -D there mean as in 
> -Djava.io.tempdir?
> 
> Michael
> 
> Martin Gainty wrote:
> 
>> Good Afternoon Michael
>> Perusing the Manual for Jspc at
>> http://64.233.167.104/search?q=cache:pfbfEPvvvHUJ:www.gefionsoftware.com/Lit 
>>
>> eWebServer/lws-jsp/ReferenceManual.pdf+TOMCAT+java.io.tempDir+-Djava.io.temp 
>>
>> Dir&hl=en
>> formal syntax for the JSPC command
>> jspc [options] -webapp web-app-root-dir
>> Where option
>> -d output-dir specifies
>> The -d output-dir specification is the directory specified by the
>> java.io.tempdir system property
>> I see that there are 2 ways to specify java.io.tempdir System Property
>> Anyone else
>> The directory specified by the java.io.tempdirsystem property The 
>> directory
>> specified by the java.io.tempdirsystem property The directory 
>> specified by
>> the java.io.tempdirsystem property The directory specified by the
>> java.io.tempdir???
>> Martin
>> ----- Original Message -----
>> From: "Michael McGrady" <mi...@michaelmcgrady.com>
>> To: "Tomcat Developers List" <to...@jakarta.apache.org>
>> Sent: Thursday, October 14, 2004 11:46 AM
>> Subject: Re: java.io.tempdir Problems
>>
>>
>>  
>>
>>> Martin,
>>>
>>> Perhaps I should add, Martin, that if I set the environment variables
>>> for java.io.tempdir and -Djava.io.tempdir in the application but not in
>>> Tomcat startup, I don't have the problem.  I am a bit confused about
>>> whether to use java.io.tempdir or -Djava.io.tempdir.  Can you explain a
>>> bit about that?
>>>
>>> Michael McGrady
>>>
>>> Martin Gainty wrote:
>>>
>>>   
>>>
>>>> Michael
>>>> createTempFile employs 3 steps algorithm to locate/create "tempDir"
>>>> 1) Attempt to retrieve the value of "javax.servlet.context.tempdir" 
>>>> from
>>>>     
>>
>> the
>>  
>>
>>>>  ServletContext
>>>> 2) If that's not found, attempt to retrieve the value of the
>>>>     
>>
>> init-parameter
>>  
>>
>>>>  "tempDir"
>>>> 3) If that's not found, default to the system-wide temp directory
>>>>     
>>
>> specified
>>  
>>
>>>>  by the system property "java.io.tempdir"
>>>> A)what is the value of "javax.servlet.context.tempdir" from the
>>>> ServletContext?
>>>> B)what is the value of the init-parameter   "tempDir"?
>>>> Martin-
>>>> ----- Original Message -----
>>>> From: "Michael McGrady" <mi...@michaelmcgrady.com>
>>>> To: "Tomcat Developers List" <to...@jakarta.apache.org>
>>>> Sent: Thursday, October 14, 2004 3:16 AM
>>>> Subject: java.io.tempdir Problems
>>>>
>>>>
>>>>
>>>>
>>>>     
>>>>
>>>>> I hope this is Tomcat related.  If not, please accept my apologies, 
>>>>> and
>>>>> give me direction.  I have removed from my Tomcat 5 (Struts 1.2 
>>>>> using a
>>>>> custom taglib) service the java.io.tempdir setting because when I use
>>>>> the following code:
>>>>>
>>>>>    File file = new File(Classpath.WEB_INF +
>>>>>                    "resource"        + File.separator +
>>>>>                    "content_type"    + File.separator +
>>>>>                    "ttf"             + File.separator +
>>>>>                     physicalName);
>>>>>    FileInputStream fontStream = new FileInputStream(file);
>>>>>    Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
>>>>>    font = font.deriveFont(attributes);
>>>>>    fontStream.close();
>>>>>
>>>>> I get temp files of around 50 - 150 kilobytes each written to the temp
>>>>> directory.  I requested assistance on Tomcat User without an answer.
>>>>>
>>>>> Anyway, I assume that there may be a concurrency issue of 
>>>>> somekind.  Is
>>>>> that right?  Anyone with any assistance out there?
>>>>>
>>>>> Michael McGrady
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>       
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>     
>>>
>>>   
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>
>>
>>
>>
>>  
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: java.io.tempdir Problems

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
I don't know if this is helpful or not, Martin, but if you attempt 
System.getenv("java.io.tempdir") [which is deprecated], you get as part 
of the error message
"getenv no longer supported, use properties and -D instead: 
java.io.tempdir".  Is that helpful?  Does the -D there mean as in 
-Djava.io.tempdir?

Michael

Martin Gainty wrote:

>Good Afternoon Michael
>Perusing the Manual for Jspc at
>http://64.233.167.104/search?q=cache:pfbfEPvvvHUJ:www.gefionsoftware.com/Lit
>eWebServer/lws-jsp/ReferenceManual.pdf+TOMCAT+java.io.tempDir+-Djava.io.temp
>Dir&hl=en
>formal syntax for the JSPC command
>jspc [options] -webapp web-app-root-dir
>Where option
>-d output-dir specifies
>The -d output-dir specification is the directory specified by the
>java.io.tempdir system property
>I see that there are 2 ways to specify java.io.tempdir System Property
>Anyone else
>The directory specified by the java.io.tempdirsystem property The directory
>specified by the java.io.tempdirsystem property The directory specified by
>the java.io.tempdirsystem property The directory specified by the
>java.io.tempdir???
>Martin
>----- Original Message -----
>From: "Michael McGrady" <mi...@michaelmcgrady.com>
>To: "Tomcat Developers List" <to...@jakarta.apache.org>
>Sent: Thursday, October 14, 2004 11:46 AM
>Subject: Re: java.io.tempdir Problems
>
>
>  
>
>>Martin,
>>
>>Perhaps I should add, Martin, that if I set the environment variables
>>for java.io.tempdir and -Djava.io.tempdir in the application but not in
>>Tomcat startup, I don't have the problem.  I am a bit confused about
>>whether to use java.io.tempdir or -Djava.io.tempdir.  Can you explain a
>>bit about that?
>>
>>Michael McGrady
>>
>>Martin Gainty wrote:
>>
>>    
>>
>>>Michael
>>>createTempFile employs 3 steps algorithm to locate/create "tempDir"
>>>1) Attempt to retrieve the value of "javax.servlet.context.tempdir" from
>>>      
>>>
>the
>  
>
>>>  ServletContext
>>>2) If that's not found, attempt to retrieve the value of the
>>>      
>>>
>init-parameter
>  
>
>>>  "tempDir"
>>>3) If that's not found, default to the system-wide temp directory
>>>      
>>>
>specified
>  
>
>>>  by the system property "java.io.tempdir"
>>>A)what is the value of "javax.servlet.context.tempdir" from the
>>>ServletContext?
>>>B)what is the value of the init-parameter   "tempDir"?
>>>Martin-
>>>----- Original Message -----
>>>From: "Michael McGrady" <mi...@michaelmcgrady.com>
>>>To: "Tomcat Developers List" <to...@jakarta.apache.org>
>>>Sent: Thursday, October 14, 2004 3:16 AM
>>>Subject: java.io.tempdir Problems
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>I hope this is Tomcat related.  If not, please accept my apologies, and
>>>>give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a
>>>>custom taglib) service the java.io.tempdir setting because when I use
>>>>the following code:
>>>>
>>>>    File file = new File(Classpath.WEB_INF +
>>>>                    "resource"        + File.separator +
>>>>                    "content_type"    + File.separator +
>>>>                    "ttf"             + File.separator +
>>>>                     physicalName);
>>>>    FileInputStream fontStream = new FileInputStream(file);
>>>>    Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
>>>>    font = font.deriveFont(attributes);
>>>>    fontStream.close();
>>>>
>>>>I get temp files of around 50 - 150 kilobytes each written to the temp
>>>>directory.  I requested assistance on Tomcat User without an answer.
>>>>
>>>>Anyway, I assume that there may be a concurrency issue of somekind.  Is
>>>>that right?  Anyone with any assistance out there?
>>>>
>>>>Michael McGrady
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: java.io.tempdir Problems

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Hi, Martin,

Did something not come through on this email?  I am not following this.

Martin Gainty wrote:

>Good Afternoon Michael
>Perusing the Manual for Jspc at
>http://64.233.167.104/search?q=cache:pfbfEPvvvHUJ:www.gefionsoftware.com/Lit
>eWebServer/lws-jsp/ReferenceManual.pdf+TOMCAT+java.io.tempDir+-Djava.io.temp
>Dir&hl=en
>formal syntax for the JSPC command
>jspc [options] -webapp web-app-root-dir
>Where option
>-d output-dir specifies
>The -d output-dir specification is the directory specified by the
>java.io.tempdir system property
>I see that there are 2 ways to specify java.io.tempdir System Property
>Anyone else
>The directory specified by the java.io.tempdirsystem property The directory
>specified by the java.io.tempdirsystem property The directory specified by
>the java.io.tempdirsystem property The directory specified by the
>java.io.tempdir???
>Martin
>----- Original Message -----
>From: "Michael McGrady" <mi...@michaelmcgrady.com>
>To: "Tomcat Developers List" <to...@jakarta.apache.org>
>Sent: Thursday, October 14, 2004 11:46 AM
>Subject: Re: java.io.tempdir Problems
>
>
>  
>
>>Martin,
>>
>>Perhaps I should add, Martin, that if I set the environment variables
>>for java.io.tempdir and -Djava.io.tempdir in the application but not in
>>Tomcat startup, I don't have the problem.  I am a bit confused about
>>whether to use java.io.tempdir or -Djava.io.tempdir.  Can you explain a
>>bit about that?
>>
>>Michael McGrady
>>
>>Martin Gainty wrote:
>>
>>    
>>
>>>Michael
>>>createTempFile employs 3 steps algorithm to locate/create "tempDir"
>>>1) Attempt to retrieve the value of "javax.servlet.context.tempdir" from
>>>      
>>>
>the
>  
>
>>>  ServletContext
>>>2) If that's not found, attempt to retrieve the value of the
>>>      
>>>
>init-parameter
>  
>
>>>  "tempDir"
>>>3) If that's not found, default to the system-wide temp directory
>>>      
>>>
>specified
>  
>
>>>  by the system property "java.io.tempdir"
>>>A)what is the value of "javax.servlet.context.tempdir" from the
>>>ServletContext?
>>>B)what is the value of the init-parameter   "tempDir"?
>>>Martin-
>>>----- Original Message -----
>>>From: "Michael McGrady" <mi...@michaelmcgrady.com>
>>>To: "Tomcat Developers List" <to...@jakarta.apache.org>
>>>Sent: Thursday, October 14, 2004 3:16 AM
>>>Subject: java.io.tempdir Problems
>>>
>>>
>>>
>>>
>>>      
>>>
>>>>I hope this is Tomcat related.  If not, please accept my apologies, and
>>>>give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a
>>>>custom taglib) service the java.io.tempdir setting because when I use
>>>>the following code:
>>>>
>>>>    File file = new File(Classpath.WEB_INF +
>>>>                    "resource"        + File.separator +
>>>>                    "content_type"    + File.separator +
>>>>                    "ttf"             + File.separator +
>>>>                     physicalName);
>>>>    FileInputStream fontStream = new FileInputStream(file);
>>>>    Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
>>>>    font = font.deriveFont(attributes);
>>>>    fontStream.close();
>>>>
>>>>I get temp files of around 50 - 150 kilobytes each written to the temp
>>>>directory.  I requested assistance on Tomcat User without an answer.
>>>>
>>>>Anyway, I assume that there may be a concurrency issue of somekind.  Is
>>>>that right?  Anyone with any assistance out there?
>>>>
>>>>Michael McGrady
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>
>>>
>>>      
>>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: java.io.tempdir Problems

Posted by Martin Gainty <mg...@hotmail.com>.
Good Afternoon Michael
Perusing the Manual for Jspc at
http://64.233.167.104/search?q=cache:pfbfEPvvvHUJ:www.gefionsoftware.com/Lit
eWebServer/lws-jsp/ReferenceManual.pdf+TOMCAT+java.io.tempDir+-Djava.io.temp
Dir&hl=en
formal syntax for the JSPC command
jspc [options] -webapp web-app-root-dir
Where option
-d output-dir specifies
The -d output-dir specification is the directory specified by the
java.io.tempdir system property
I see that there are 2 ways to specify java.io.tempdir System Property
Anyone else
The directory specified by the java.io.tempdirsystem property The directory
specified by the java.io.tempdirsystem property The directory specified by
the java.io.tempdirsystem property The directory specified by the
java.io.tempdir???
Martin
----- Original Message -----
From: "Michael McGrady" <mi...@michaelmcgrady.com>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Thursday, October 14, 2004 11:46 AM
Subject: Re: java.io.tempdir Problems


> Martin,
>
> Perhaps I should add, Martin, that if I set the environment variables
> for java.io.tempdir and -Djava.io.tempdir in the application but not in
> Tomcat startup, I don't have the problem.  I am a bit confused about
> whether to use java.io.tempdir or -Djava.io.tempdir.  Can you explain a
> bit about that?
>
> Michael McGrady
>
> Martin Gainty wrote:
>
> >Michael
> >createTempFile employs 3 steps algorithm to locate/create "tempDir"
> >1) Attempt to retrieve the value of "javax.servlet.context.tempdir" from
the
> >   ServletContext
> >2) If that's not found, attempt to retrieve the value of the
init-parameter
> >   "tempDir"
> >3) If that's not found, default to the system-wide temp directory
specified
> >   by the system property "java.io.tempdir"
> >A)what is the value of "javax.servlet.context.tempdir" from the
> >ServletContext?
> >B)what is the value of the init-parameter   "tempDir"?
> >Martin-
> >----- Original Message -----
> >From: "Michael McGrady" <mi...@michaelmcgrady.com>
> >To: "Tomcat Developers List" <to...@jakarta.apache.org>
> >Sent: Thursday, October 14, 2004 3:16 AM
> >Subject: java.io.tempdir Problems
> >
> >
> >
> >
> >>I hope this is Tomcat related.  If not, please accept my apologies, and
> >>give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a
> >>custom taglib) service the java.io.tempdir setting because when I use
> >>the following code:
> >>
> >>     File file = new File(Classpath.WEB_INF +
> >>                     "resource"        + File.separator +
> >>                     "content_type"    + File.separator +
> >>                     "ttf"             + File.separator +
> >>                      physicalName);
> >>     FileInputStream fontStream = new FileInputStream(file);
> >>     Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
> >>     font = font.deriveFont(attributes);
> >>     fontStream.close();
> >>
> >>I get temp files of around 50 - 150 kilobytes each written to the temp
> >>directory.  I requested assistance on Tomcat User without an answer.
> >>
> >>Anyway, I assume that there may be a concurrency issue of somekind.  Is
> >>that right?  Anyone with any assistance out there?
> >>
> >>Michael McGrady
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
> >
> >
> >
> >
> >
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: java.io.tempdir Problems

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Martin,

Perhaps I should add, Martin, that if I set the environment variables 
for java.io.tempdir and -Djava.io.tempdir in the application but not in 
Tomcat startup, I don't have the problem.  I am a bit confused about 
whether to use java.io.tempdir or -Djava.io.tempdir.  Can you explain a 
bit about that?

Michael McGrady

Martin Gainty wrote:

>Michael
>createTempFile employs 3 steps algorithm to locate/create "tempDir"
>1) Attempt to retrieve the value of "javax.servlet.context.tempdir" from the
>   ServletContext
>2) If that's not found, attempt to retrieve the value of the init-parameter
>   "tempDir"
>3) If that's not found, default to the system-wide temp directory specified
>   by the system property "java.io.tempdir"
>A)what is the value of "javax.servlet.context.tempdir" from the
>ServletContext?
>B)what is the value of the init-parameter   "tempDir"?
>Martin-
>----- Original Message -----
>From: "Michael McGrady" <mi...@michaelmcgrady.com>
>To: "Tomcat Developers List" <to...@jakarta.apache.org>
>Sent: Thursday, October 14, 2004 3:16 AM
>Subject: java.io.tempdir Problems
>
>
>  
>
>>I hope this is Tomcat related.  If not, please accept my apologies, and
>>give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a
>>custom taglib) service the java.io.tempdir setting because when I use
>>the following code:
>>
>>     File file = new File(Classpath.WEB_INF +
>>                     "resource"        + File.separator +
>>                     "content_type"    + File.separator +
>>                     "ttf"             + File.separator +
>>                      physicalName);
>>     FileInputStream fontStream = new FileInputStream(file);
>>     Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
>>     font = font.deriveFont(attributes);
>>     fontStream.close();
>>
>>I get temp files of around 50 - 150 kilobytes each written to the temp
>>directory.  I requested assistance on Tomcat User without an answer.
>>
>>Anyway, I assume that there may be a concurrency issue of somekind.  Is
>>that right?  Anyone with any assistance out there?
>>
>>Michael McGrady
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>
>
>
>  
>


Re: java.io.tempdir Problems

Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Martin Gainty wrote:

>Michael
>createTempFile employs 3 steps algorithm to locate/create "tempDir"
>1) Attempt to retrieve the value of "javax.servlet.context.tempdir" from the
>   ServletContext
>2) If that's not found, attempt to retrieve the value of the init-parameter
>   "tempDir"
>3) If that's not found, default to the system-wide temp directory specified
>   by the system property "java.io.tempdir"
>A)what is the value of "javax.servlet.context.tempdir" from the
>ServletContext?
>B)what is the value of the init-parameter   "tempDir"?
>Martin-
>----- Original Message -----
>From: "Michael McGrady" <mi...@michaelmcgrady.com>
>To: "Tomcat Developers List" <to...@jakarta.apache.org>
>Sent: Thursday, October 14, 2004 3:16 AM
>Subject: java.io.tempdir Problems
>
>
>  
>
>>I hope this is Tomcat related.  If not, please accept my apologies, and
>>give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a
>>custom taglib) service the java.io.tempdir setting because when I use
>>the following code:
>>
>>     File file = new File(Classpath.WEB_INF +
>>                     "resource"        + File.separator +
>>                     "content_type"    + File.separator +
>>                     "ttf"             + File.separator +
>>                      physicalName);
>>     FileInputStream fontStream = new FileInputStream(file);
>>     Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
>>     font = font.deriveFont(attributes);
>>     fontStream.close();
>>
>>I get temp files of around 50 - 150 kilobytes each written to the temp
>>directory.  I requested assistance on Tomcat User without an answer.
>>
>>Anyway, I assume that there may be a concurrency issue of somekind.  Is
>>that right?  Anyone with any assistance out there?
>>
>>Michael McGrady
>>

Martin,

First, thanks for responding. 

Second, the entirety of the startup code setting my java.io.tempdir 
system property is after this note, but the value of the property is 
"%CATALINA_HOME%\temp.  The value of javax.servlet.context.tempdir is 
C:\crackwillow\work\Catalina\localhost\_ .  Following the knowledge I 
gleaned from your question and specifications, I reset things in a 
plugin, and I now have the values at runtime of:

javax.servlet.context.tempdir = C:\crackwillow\work\Catalina\localhost\_
-Djava.io.tempdir = C:/crackwillow/temp
java.io.tempdir = C:/crackwillow/temp

Prior to doing this, my values for both -Djava.io.tempdir and 
java.io.tempdir were null. 

I have kept the value of the java.io.tempdir in my  at 
C:/crackwillow/temp.  When I run the font program as previously 
indicated (see above), I still get the tmp files that do not go away.  
Their names are as follows: +~JF3174.tmp and they run consequtively. 

What do you think is up?

Michael McGrady

@echo off
if "%OS%" == "Windows_NT" setlocal
rem 
---------------------------------------------------------------------------
rem NT Service Install/Uninstall script
rem
rem Options
rem install                Install the service using Tomcat5 as service 
name.
rem                        Service is installed using default settings.
rem remove                 Remove the service from the System.
rem
rem name        (optional) If the second argument is present it is 
considered
rem                        to be new service 
name                                          
rem
rem $Id: service.bat,v 1.1 2003/12/27 18:56:58 mdsh Exp $
rem 
---------------------------------------------------------------------------

rem Guess CATALINA_HOME if not defined
set CURRENT_DIR=%cd%
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=%cd%
if exist "%CATALINA_HOME%\bin\tomcat.exe" goto okHome
rem CD to the upper dir
cd ..
set CATALINA_HOME=%cd%
:gotHome
if exist "%CATALINA_HOME%\bin\tomcat.exe" goto okHome
echo The tomcat.exe was not found...
echo The CATALINA_HOME environment variable is not defined correctly.
echo This environment variable is needed to run this program
goto end
:okHome

set EXECUTABLE="%CATALINA_HOME%\bin\tomcat.exe"

rem Set default Service name
set SERVICE_NAME=Tomcat5

if "%1" == "" goto displayUsage
if "%2" == "" goto setServiceName
set SERVICE_NAME=%2
:setServiceName
if %1 == install goto doInstall
if %1 == remove goto doRemove
echo Unknown parameter "%1"
:displayUsage
echo
echo Usage: service.bat install/remove [service_name]
goto end

:doRemove
rem Remove the service
%EXECUTABLE% //DS//%SERVICE_NAME%
echo The service '%SERVICE_NAME%' has been removed
goto end

:doInstall
rem Install the service
%EXECUTABLE% //IS//%SERVICE_NAME% --DisplayName "Apache Tomcat" 
--Description "Apache Tomcat Server - http://jakarta.apache.org/tomcat/"
%EXECUTABLE% //US//%SERVICE_NAME% --Install %EXECUTABLE%
%EXECUTABLE% //US//%SERVICE_NAME% --ImagePath 
"%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar"
%EXECUTABLE% //US//%SERVICE_NAME% --Java 
"%JAVA_HOME%\jre\bin\server\jvm.dll"
%EXECUTABLE% //US//%SERVICE_NAME% --StartupClass 
org.apache.catalina.startup.Bootstrap;main;start --ShutdownClass 
org.apache.catalina.startup.Bootstrap;main;stop --Startup auto
rem Set extra parameters
%EXECUTABLE% //US//%SERVICE_NAME% --JavaOptions 
-Dcatalina.home="\"%CATALINA_HOME%\""#-Djava.endorsed.dirs="\"%CATALINA_HOME%\common\endorsed\""#-Djava.io.tmpdir="\"%CATALINA_HOME%\temp\""#-Xms32m#-Xmx256m#-Xrs
%EXECUTABLE% //US//%SERVICE_NAME% --StdOutputFile 
"%CATALINA_HOME%\logs\stdout.log"
%EXECUTABLE% //US//%SERVICE_NAME% --StdErrorFile 
"%CATALINA_HOME%\logs\stderr.log"
%EXECUTABLE% //US//%SERVICE_NAME% --WorkingPath "%CATALINA_HOME%\bin"
echo The service '%SERVICE_NAME%' has been installed

:end
cd %CURRENT_DIR%



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: java.io.tempdir Problems

Posted by Martin Gainty <mg...@hotmail.com>.
Michael
createTempFile employs 3 steps algorithm to locate/create "tempDir"
1) Attempt to retrieve the value of "javax.servlet.context.tempdir" from the
   ServletContext
2) If that's not found, attempt to retrieve the value of the init-parameter
   "tempDir"
3) If that's not found, default to the system-wide temp directory specified
   by the system property "java.io.tempdir"
A)what is the value of "javax.servlet.context.tempdir" from the
ServletContext?
B)what is the value of the init-parameter   "tempDir"?
Martin-
----- Original Message -----
From: "Michael McGrady" <mi...@michaelmcgrady.com>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Thursday, October 14, 2004 3:16 AM
Subject: java.io.tempdir Problems


> I hope this is Tomcat related.  If not, please accept my apologies, and
> give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a
> custom taglib) service the java.io.tempdir setting because when I use
> the following code:
>
>      File file = new File(Classpath.WEB_INF +
>                      "resource"        + File.separator +
>                      "content_type"    + File.separator +
>                      "ttf"             + File.separator +
>                       physicalName);
>      FileInputStream fontStream = new FileInputStream(file);
>      Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
>      font = font.deriveFont(attributes);
>      fontStream.close();
>
> I get temp files of around 50 - 150 kilobytes each written to the temp
> directory.  I requested assistance on Tomcat User without an answer.
>
> Anyway, I assume that there may be a concurrency issue of somekind.  Is
> that right?  Anyone with any assistance out there?
>
> Michael McGrady
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


AW: java.io.tempdir Problems

Posted by "S. Dierkes" <sd...@mediaclockwork.de>.
This is probably not a Tomcat problem, I got the same behaviour without
Tomcat in a java application and also with a webapp in BEA. The temporary
files are created by java itself (or more precise by some font handling in
java.awt). I found this behaviour on a Windows machine independent from the
tempdir settings, i.e. if not explicitly set, some automatic detected temp
dir was chosen - depending of windows version, resp. environment variable
settings (check your TEMP, TMP settings and under XP there is some directory
under the user's directory - can't remember). BTW, your lucky with only 50
kb, depending of font these could also be also several MB. Since we had some
other problems with java.awt.font, e.g. in headless environments we wrote a
lot of wrappers for several functions, so we came around this problem a
really hard way. Some suggestions
1. okay these files are temp files, so should go away if you shutdown clean,
but from my observations this doesn't happen all the time, but setting
System.runFinalizersOnExit improved this behaviour at our first tests, but
of course this may introduce other problems.
2. our first solution was cleaning up the directory manually on startup of
application, may be you can think of a similiar solution - even on a server
application. From our observations, if you reuse the font objects there is
only one temp file per font, so after all it's not a real problem if you
gather some temp files (unless you have thousands of fonts) and clean them
up on each server start.



-----Ursprüngliche Nachricht-----
Von: Michael McGrady [mailto:mike@michaelmcgrady.com]
Gesendet: Donnerstag, 14. Oktober 2004 08:16
An: Tomcat Developers List
Betreff: java.io.tempdir Problems


I hope this is Tomcat related.  If not, please accept my apologies, and
give me direction.  I have removed from my Tomcat 5 (Struts 1.2 using a
custom taglib) service the java.io.tempdir setting because when I use
the following code:

     File file = new File(Classpath.WEB_INF +
                     "resource"        + File.separator +
                     "content_type"    + File.separator +
                     "ttf"             + File.separator +
                      physicalName);
     FileInputStream fontStream = new FileInputStream(file);
     Font font = Font.createFont(Font.TRUETYPE_FONT,fontStream);
     font = font.deriveFont(attributes);
     fontStream.close();

I get temp files of around 50 - 150 kilobytes each written to the temp
directory.  I requested assistance on Tomcat User without an answer.

Anyway, I assume that there may be a concurrency issue of somekind.  Is
that right?  Anyone with any assistance out there?

Michael McGrady


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org