api 服务器在收到放置请求时无法创建文件
The api server cannot create the file when receives a put request
我是 API 新手。我有一个 java api 服务器。在服务器端的 put 方法中,我收到一个字符串并使用该字符串创建一个 arff 文件。然后我对该文件进行了一些处理,结果 return 是另一个字符串。
问题是,当我执行放置请求时,文件未在本地路径中创建,但是当我 运行 本地应用程序上的代码用于测试文件时,该文件已创建,因此代码有效。
我必须生成该字符串的文件,因为我使用的机器学习算法仅适用于 files.Does 有人知道这是为什么吗?
在服务器端的put方法中调用了Classify text方法
public static int ClassifyText(String trained_model, String text) throws FileNotFoundException, IOException, Exception {
String evaluation_file = "..\toBeClassified_text.arff";
//create a arff file for the text
FileWriter fileWriter = new FileWriter(new File(evaluation_file));
PrintWriter printWriter = new PrintWriter(fileWriter);
问题通过修改这一行解决:
字符串 evaluation_file = "D:\toBeClassified_text.arff";
我是 API 新手。我有一个 java api 服务器。在服务器端的 put 方法中,我收到一个字符串并使用该字符串创建一个 arff 文件。然后我对该文件进行了一些处理,结果 return 是另一个字符串。 问题是,当我执行放置请求时,文件未在本地路径中创建,但是当我 运行 本地应用程序上的代码用于测试文件时,该文件已创建,因此代码有效。 我必须生成该字符串的文件,因为我使用的机器学习算法仅适用于 files.Does 有人知道这是为什么吗?
在服务器端的put方法中调用了Classify text方法
public static int ClassifyText(String trained_model, String text) throws FileNotFoundException, IOException, Exception {
String evaluation_file = "..\toBeClassified_text.arff";
//create a arff file for the text
FileWriter fileWriter = new FileWriter(new File(evaluation_file));
PrintWriter printWriter = new PrintWriter(fileWriter);
问题通过修改这一行解决:
字符串 evaluation_file = "D:\toBeClassified_text.arff";