Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在adf mobile中创建文件_Java_File_Mobile_Oracle Adf - Fatal编程技术网

Java 如何在adf mobile中创建文件

Java 如何在adf mobile中创建文件,java,file,mobile,oracle-adf,Java,File,Mobile,Oracle Adf,我用这段代码在手机设备上创建一些文件,例如:txt,pdf…等等 try { File file = new File("myfile.txt"); if (file.createNewFile()) { //throw new AdfException("crée", AdfException.INFO); } else { throw

我用这段代码在手机设备上创建一些文件,例如:txt,pdf…等等

    try
    {
        File file = new File("myfile.txt");
        if (file.createNewFile())
        {
            //throw new AdfException("crée", AdfException.INFO);
        }
        else
        {
            throw new AdfException("non crée", AdfException.INFO);
        }
    } 
    catch (IOException e) 
    {
        throw new AdfException(e.getMessage(), AdfException.INFO);
    }

但我有一条错误消息:只读文件系统

我认为您需要在应用程序文件夹下创建文件

String dir = AdfmfJavaUtilities.getDirectoryPathRoot(AdfmfJavaUtilities.ApplicationDirectory);
String filePath= dir + "/myfile.txt";
try
    {
        File file = new File(filePath);
        if (file.createNewFile())
        {
            //throw new AdfException("crée", AdfException.INFO);
        }
        else
        {
            throw new AdfException("non crée", AdfException.INFO);
        }
    } 
    catch (IOException e) 
    {
        throw new AdfException(e.getMessage(), AdfException.INFO);
    }

非常感谢。另一个问题,如何使用adf Mobile查找电话名或imei id欢迎,如果问题已解决,请将其标记为正确答案,同时为了组织起见,请在单独的帖子中询问其他问题。