Yeah I thought that - but it is not the case. I have tested my package
outside of Tomcat and the file is created and I can see it ok. It is just
weird that it isn't visible in Tomcat. Good suggestion tho.
Clive
----- Original Message -----
From: "Denise Mangano" <[EMAIL PROTECTED]>
To: "'Tomcat Users List '" <[EMAIL PROTECTED]>
Sent: Wednesday, January 15, 2003 3:48 AM
Subject: RE: saving and opening files
> This is a really dumb suggestion, but I thought I would throw it out
there.
> Is it possible that for some reason this file is 'hidden' and your folder
> options are not set to view hidden files??
>
> I tried something similar on my machine, and the file was not hidden, but
> its a stab in the dark so I figured I'd say it anyway :)...
>
> Denise
>
> -----Original Message-----
> From: Clive De Silva
> To: Julius Davies; Tomcat Users List
> Sent: 1/14/2003 5:36 PM
> Subject: Re: saving and opening files
>
> Hi - just tried your suggestion and it returns:
> I'm file2 and I am at C:\Program Files\Apache Group\Tomcat
> 4.1\states.gip
> - and guess what, it is not there!Any other ideas? ;-)
>
> Clive
>
> ----- Original Message -----
> From: "Julius Davies" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Tuesday, January 14, 2003 12:08 AM
> Subject: RE: saving and opening files
>
>
>
> Clive De Silva,
>
> I may be wrong, but I think your file would be here:
>
> System.getProperty( "user.dir" );
>
> That should output a string showing the directory where your files will
> be
> put by default. This is because you specified a relative path -- new
> java.io.File("states.gip") -- not an absolute path.
>
> You can call 'System.getProperty( "user.dir" )' at anytime from anywhere
> in
> your application, even a jsp.
>
> yours,
>
> Julius Davies, Programmer, CUCBC
> Email: [EMAIL PROTECTED], Ph: 604.730.6385
>
>
>
>
> > -----Original Message-----
> > From: Clive De Silva [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 13, 2003 3:48 PM
> > To: [EMAIL PROTECTED]
> > Subject: saving and opening files
> >
> >
> > Hi, I have placed my package in the \Apache Group\Tomcat
> > 4.1\common\classes\ folder and they are all standard Java
> > classes [no servlets or jsps]. One of the methods invoked in
> > my main class serializes an object and saves it to a
> > persistent file at runtime :
> >
> > ---------------------Start Snip 1-----------------------
> > public boolean saveUser(){
> > File file2 = new java.io.File("states.gip");
> > try{
> > myUser.allocateUser(user);
> > FileOutputStream out2 = new FileOutputStream(file2);
> > ObjectOutputStream s2 = new ObjectOutputStream(out2);
> > s2.writeObject(myUser);
> > s2.flush();
> > System.out.println("You have save successfully");
> > return true;
> > }
> > catch(Exception e){
> > e.printStackTrace();
> > System.out.println("You have save UN-Successfully");
> > return false;
> > }
> > }
> > ---------------------End Snip 1-----------------------
> >
> > When the class is initialised/created, it first checks to see
> > if there is a file called states.gip and if there is, then it
> > reads in the object, if there isnt, then it creates an object
> > and at a latter stage saves it:
> >
> > ---------------------Start Snip 2-----------------------
> > public boolean createUser(String name){
> > try{//see if a user had been created and try to load it back
> > File file2 = new java.io.File("states.gip");
> > FileInputStream in = new FileInputStream(file2);
> > ObjectInputStream s1 = new ObjectInputStream(in);
> > myUser = (MainUser)s1.readObject();
> > user = recommenderEPG.addUser(name);
> > user = myUser.unallocate(user);
> > System.out.println("There was an old user!");
> > return true;
> > }
> > catch(Exception e){//user has not been created so an
> > exception is thrown -going to create a new user
> > try{
> > myUser = new MainUser(name);
> > user = recommenderEPG.addUser(name);
> > myUser.allocateUser(user);
> > System.out.println("there is definitely no old user");
> > return true;
> > }
> > catch (DataNotFoundException ef){
> > return false;
> > }
> > }
> > ---------------------End Snip 2-----------------------
> >
> > When the class does get created for the first time, it does
> > not see the 'states.gip' file, which is correct, because it
> > has not been created yet. If it is instantiated for a second
> > or nth time, it always sees the file and loads it correctly.
> > My Question is: where is this file stored? I can not find a
> > physical trace of this file - i have done search after search
> > and it is not there - yet the Java class opens it correcly!!!!! Help!
> >
> >
> > Regards,
> >
> > Clive
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/2002
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>