• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

change default directory

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ,
i want to change tomcat default directory. i am working on a program where i have to pass form data to servlet .

my form data folder:

C:\apache-tomcat-6.0.20\webapps\ROOT\form-data



my servlet folder:

C:\apache-tomcat-6.0.20\webapps\ROOT\WEB-INF\classes




i want to change both the form-data folder & servlet folder to a different location like

C:\apache-tomcat-6.0.20\webapps\ROOT\mydir



in this folder i want to keep both my form-data and classfiles.

how can i change it. explain briefly.

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you can't. And you shouldn't, either. Why should Tomcat's current working directory be inside one of the possibily several web applications it controls?

Perhaps you should describe your actual problem. Tomcat's working directory should not have anything to do with your question.
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Perhaps you should describe your actual problem.



i mean , now i am working on a resume creation project so i want to have different folder where i can keep all my data .
besides it is also better to have own directory rather than using tomcat's default servlet directory.

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but again, what does that have to do with any concept of a "current directory"? Describe your problem, not a solution.
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have two files threeparamsform.html and threeparams.class in trp folder with path

C:\apache-tomcat-6.0.20\webapps\ROOT\trp



threeparamsform.html


threeparams.java


my problem:

when i enter data at this url

http://localhost:8080/trp/threeparamsform.html



it comes to this url

http://localhost:8080/trp/threeparams?first=tushar&second=ranjan&third=panda



and gives error this :


what went wrong
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, repeat after me, children:

A web server is not a file server
A web server is not a file server
A web server is not a file server

A file server is a place where you can read and write files via ordinary filesystem I/O calls. A web server is a place where you send HTTP requests and get HTTP responses. Web URLs may look like file directory tree references, but it's only appearances, not reality. If the application running in the web server wants to root around the components of its WAR and return resources using the URL as a model, it may do so. However, if it chooses to do something entirely different, it can do that, too.

The one thing I'll say for certain, because somebody burned me quite badly on this within the last 6 months is that you should never upload files into a WAR. Firstly, because unless the WAR is an exploded WAR, there's no directories to upload into; J2EE doesn't support replacing parts of a WAR file.

Secondly - and this is where I got burned - even in the case of an exploded WAR, a redeployment of the webapp is likely to wipe out all those uploaded files.

There's nothing wrong with uploading files. Just upload them to a designated data directory, and not to an internal location in the webapp. You can hard-code a directory path into the app if you must, but personally, I prefer to make the upload directory a resource defined in web.xml, where JNDI can look it up and Tomcat can override it if it needs to.
reply
    Bookmark Topic Watch Topic
  • New Topic