Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9127015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:11:08+00:00 2026-06-17T07:11:08+00:00

I have xampp installed in my windows system and lampp installed in my linux

  • 0

I have xampp installed in my windows system and lampp installed in my linux system. I want to create folder in the location “http://localhost/” using java. I have done the following :

dirName = new File("http://localhost/"+name);
if(!dirName.exists()) {
    dirName.mkdir();
}

Is it possible to do? The idea is to download some files to that location programatically. Download is working but how do I create folders so that I can access it via http://example.com/name. This is required to keep track of the user related content. I have access to the apache web server with lampp already installed. How can I create folders and save the downloads to that folder with programmatically assigning the permissions to the folder and contents within it so that saved contents can be download from there using wget method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:11:09+00:00Added an answer on June 17, 2026 at 7:11 am

    In Java you can create files in any writeable directory on your system by doing something like:

    File file1 = new File("/var/www/newDirectory/");
    file1.mkdirs();
    

    Then to create a file in that directory you can do something like this:

    File file2 = new File(file1.getAbsolutePath() + "newFile.txt"); // You may need to add a "File.seperator()" after the "file1.getAbsolutePath()" if the trailing "/" isn't included
    if (file2.exists() == false) {
        file2.createNewFile();
    }
    

    To ensure that your file is readable to the public you should add read permissions to the file:

    file2.setReadable(true, false);
    

    In Apache you can set up a virtual host that points to the directory where you would like to make files available from. By default on debian linux it is /var/www.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have installed Xampp for ubuntu. It is located in /opt/lampp. I want to
I have an Apache server installed on my windows machine using XAMPP. Now I'm
I have an apache server installed on my portable windows 7 machine using xampp
I have installed Xampp version 1.7.7 for windows and i want to start learning
I have XAMPP already installed on my Windows and I'm trying to turn it
I have installed xampp on Windows7(64bit).I want to work with PHP, Apache and MySql.
All, I have installed xampp for linux on ubuntu 9.10. The installation directory is
I have been installed behat in xampp (windows). I used a PEAR to install
I have XAMPP installed with PHP 5.2.6 in Windows XP. In my php.ini I
I'm using Netbeans 7.0.1 in a PHP project. I've installed XAMPP 1.7 in Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.