This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,592 Users
  • 2,269,776 Discussions
  • 7,916,825 Comments

Discussions

Why can't I write to the Raspbian Jessie filesystem?

bjuntti
bjuntti Member Posts: 14
edited Jul 4, 2016 3:14PM in Java ME Embedded

So, I'm trying to write a file on a Raspbian Jessie filesystem that my Raspberry Pi 2 Model B is

using and I'm not having any luck.  Here's a code snippet:

FilePersistentStore fileStore = new FilePersistentStore("/rootfs/var/tmp/baro-data.txt", true, INFO);

public FilePersistentStore(String fileName, boolean verbose, int messageLevel)

      throws IOException {

    this.verbose = verbose;

    this.messageLevel = messageLevel;

   

   

      /* Open the file for writing */

      String connectorName = "file://" + fileName;

      printMessage("constructor opening file: [" + connectorName + "]", INFO);

      connection = (FileConnection)Connector.open(connectorName,

          Connector.READ_WRITE);

     

      System.out.println("[FilePersistentStore] Line 51");

      /* If the file does not exist yet, create it */

      if (!connection.exists()) {

        printMessage("File does not exist, creating", INFO);

        connection.create();

      }

      System.out.println("[FilePersistentStore] Line 57");

      fileWriter = new PrintStream(connection.openOutputStream(), true);

      printMessage("Got IO streams", INFO);

  }

Note that I'm writing (or TRYING to write) to the file name "/rootfs/var/tmp/baro-data.txt" (one of

the stipulations made during the JavaME MOOC class was that YOU MUST DIRECT THE WRITE TO ROOTFS.)

This code HANGS on the Pi 2 but when I ran it on my older RPi Model B, it ran fine.  Turns out there

IS a filesystem called 'rootfs' on the older OS for the older Pi but no 'rootfs' in Jessie. 

Anybody have any ideas?

Thanks,

Bruce

Answers

This discussion has been closed.