realtive path

I created another direcory in this directory and sotred a file there to which i want to link from a note

The link to the file is:

"C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\application context\downloadables\\my file.msi

Instead of giving full path i want to give relative path..

Would there be a way to do this via a 'relative path' .

like:

..\my application\downloadables\my file.msi

Thanks alot

[479 byte] By [akaura] at [2007-11-27 11:04:45]
# 1

> Would there be a way to do this via a 'relative path'

> .

> like:

> ..\my application\downloadables\my file.msi

Did you try it?

hunter9000a at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 2

> I created another direcory in this directory and

> sotred a file there to which i want to link from a

> note

>

> The link to the file is:

> "C:\\Program Files\\Apache Software

> Foundation\\Tomcat 5.5\\webapps\\application

> context\downloadables\\my file.msi

> Instead of giving full path i want to give relative

> path..

>

>

> Would there be a way to do this via a 'relative path'

> .

> like:

> ..\my application\downloadables\my file.msi

Yes. That

georgemca at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 3

what is syntax for that

akaura at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 4

i tried this... its not working

akaura at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 5

kya baqwaaz, <<it is not working>>? kee horha hai, kuddi?

filestreama at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 6

> i tried this... its not working

We need more details. Is this a webapp? What did the link end up being when you tried to use it?

hunter9000a at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 7

here is the full code how i did:

<%@ page import="java.io.*" %>

<%

//this is to download Excel Client

FileInputStream fis = new FileInputStream("C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\ptoject name\\download folder\\file.msi");

BufferedInputStream bis = new BufferedInputStream(fis);

response.setContentLength(fis.available());

response.setContentType("application/octet-stream");

response.setHeader("Content-disposition","attachment; filename=XTM_Study_v1-0-7-beta.msi" );

BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());

byte[] buff = new byte[1024];

int bytesRead;

// Simple read/write loop.

while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))

{

bos.write(buff, 0, bytesRead);

}

bos.flush();

bos.close();

bis.close();

response.flushBuffer();

fis.close();

%>

Instead of giving full path "C:\\program files\\apache......"

i need to give relative path.. I need to know how can i give relative path?

akaura at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 8

Why can't you simply use HTTP?

<a href="\xxx\yyy.msi">Download<a>

filestreama at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 9

is there anyone who can help me...

akaura at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 10

wow, ਪੰਜਾਬੀ (ਭਾਰਤ) is broken if I try to use either a single or double quotation mark as in an href attribute.

filestreama at 2007-7-29 13:03:36 > top of Java-index,Java Essentials,New To Java...
# 11

> Why can't you simply use HTTP?

> > <a href="\xxx\yyy.msi">Download<a>

You mean HTML.

jGardnera at 2007-7-29 13:03:37 > top of Java-index,Java Essentials,New To Java...
# 12

> > Why can't you simply use HTTP?

> > > > <a href="\xxx\yyy.msi">Download<a>

>

> You mean HTML.

I think he meant let the user download the program over http by giving them a link, instead of writing the contents of the file into the response, which is completely stupid. Even redirecting them to the url of the file would be better.

OP, I'll try one last time. When you open the FileInputStream with the relative url, what's the actual url that it tries to open?

hunter9000a at 2007-7-29 13:03:37 > top of Java-index,Java Essentials,New To Java...
# 13

i tried that way but when i left cliick then its not giving me anything and when i right click and tried "save target as" that way i can only save that file but i need a dialogue box that asks users whether to save run or cancel file download.

akaura at 2007-7-29 13:03:37 > top of Java-index,Java Essentials,New To Java...
# 14

when i tried to give realtive path... its giving the error "file not found"

akaura at 2007-7-29 13:03:37 > top of Java-index,Java Essentials,New To Java...
# 15

FileInputStream fis = new FileInputStream("C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\ptoject name\\download folder\\file.msi");

ptoject name ?

And for God's sake, use STANDARD directory notation, not Windows ****:

/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/"ptoject name"/download folder/file.msi

jGardnera at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 16

anybody there to help me..?

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 17

> anybody there to help me..?

lol. I'm done here.

hunter9000a at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 18

sorry Mr. Gardener.. I just started working in java... i ll keep that in mind

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 19

sorry Mr. Gardner..

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 20

> sorry Mr. Gardner..

Are you sure the directory is named "ptoject name" ?

maybe it is named "project name" and you misspelled it?

jGardnera at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 21

director name actual is "XTM" and the i have created folder named "downloadables" in that where my file is saved..

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 22

directory name actual is "XTM" and the i have created folder named "downloadables" in that where my file is saved..

i typed it fast so it was misspelled

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 23

no solution

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 24

ji nahi

filestreama at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 25

maharaaj daso na pher solution..

i have one more issue.. how can i configure my filename.jsp as the default page in spring MVC

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 26

> maharaaj daso na pher solution..

mai tera sahib hai, kuddi?

filestreama at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...
# 27

didnt get u

akaura at 2007-7-29 13:03:45 > top of Java-index,Java Essentials,New To Java...