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

  • SEARCH
  • Home
  • 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 6974781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:16:56+00:00 2026-05-27T17:16:56+00:00

I’ve created my simple application. When I list all files and directories from .

  • 0

I’ve created my simple application.

When I list all files and directories from “.” dir I get it all from dir ‘web’. My goal is to create a new directory in ‘web’ called ‘myfile’. Unfortunately when I clicked a link on the page (which running the following code) it throws an exception…

Could you tell me how I can create file/dir in ‘web’?

And my 2nd question:

Assuming my app is bigger and used by several people. I want to create directories for all of them but it’s so uncomfortable to save all of this in my ‘web’ directory. Is it possible to create other server or take other place for ‘users’s files’?

Thanks!

package myapp;

import java.io.File;
import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.tools.ant.taskdefs.Mkdir;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class MyAppServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
              throws IOException {
        // getting logged user
        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();

        // anybody is logged
        if (user != null) {
            resp.setContentType("text/plain");
            resp.getWriter().println("Hello, " + user.getNickname());




            File test = new File(".");
            String [] tab = test.list();
            // list of files before
            for (String el : tab) {
                resp.setContentType("text/plain");
                resp.getWriter().println("File ->, " + el);
            }

            File test2 = new File("./myfile");
            test2.mkdir();

            // list of files after
            for (String el : tab) {
                resp.setContentType("text/plain");
                resp.getWriter().println("File ->, " + el);
            }


        } else {
            resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
        }
    }
}
  • 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-05-27T17:16:57+00:00Added an answer on May 27, 2026 at 5:16 pm

    GAE doesn’t have any file system. Read http://code.google.com/intl/en-US/appengine/docs/java/runtime.html#The_Sandbox:

    To allow App Engine to distribute requests for applications across
    multiple web servers, and to prevent one application from interfering
    with another, the application runs in a restricted “sandbox”
    environment. In this environment, the application can execute code,
    store and query data in the App Engine datastore, use the App Engine
    mail, URL fetch and users services, and examine the user’s web request
    and prepare the response.

    An App Engine application cannot:

    write to the filesystem. Applications must use the App Engine datastore for storing persistent data. Reading from the filesystem is
    allowed, and all application files uploaded with the application are
    available.

    […]

    Your only option is to use the datastore (and blobstore)

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

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a bunch of posts stored in text files formatted in yaml/textile (from
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported

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.