我的 Java .html 文件生成器有什么问题
What is wrong with my Java .html file generator
我正在开发可用于在浏览器中查看 .swf 文件的 .html 文件生成器,但是我遇到了 "Unresolved compilation problem" 错误。我的导入可能有问题吗?
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class CreateFile {
public static String starthtml = "<object><embed src=\"";
public static String endhtml = ".swf\" width=\"100%\" height=\"100%\"></embed></object>";
public static String s;
public static void main(String[] args) {
try {
File myObj = new File("Flash Loader.html");
if (myObj.createNewFile()) {
System.out.println("Flash Loader Created Successfully");
} else {
System.out.println("File already exists");
}
} catch (IOException e) {
System.out.println("An error occurred");
e.printStackTrace();
}
Scanner sc = new Scanner(System.in);
System.out.println("Enter SWF file name");
s = sc.nextLine();
try {
FileWriter myWriter = new FileWriter("Flash Loader.html");
myWriter.write(starthtml+sc+endhtml);
myWriter.close();
System.out.println("Successfully wrote to the file");
} catch (IOException e) {
System.out.println("An error occurred");
e.printStackTrace();
}
}
}
错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at CreateFile.main(Flash_Loader_Creator.java:10)
将我的 .java 文件重命名为 CreateFile.java 解决了这个问题谢谢 https://whosebug.com/users/1081110/dawood-says-reinstate-monica
https://whosebug.com/users/1902512/haibrayn-gonz%c3%a1lez
我正在开发可用于在浏览器中查看 .swf 文件的 .html 文件生成器,但是我遇到了 "Unresolved compilation problem" 错误。我的导入可能有问题吗?
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class CreateFile {
public static String starthtml = "<object><embed src=\"";
public static String endhtml = ".swf\" width=\"100%\" height=\"100%\"></embed></object>";
public static String s;
public static void main(String[] args) {
try {
File myObj = new File("Flash Loader.html");
if (myObj.createNewFile()) {
System.out.println("Flash Loader Created Successfully");
} else {
System.out.println("File already exists");
}
} catch (IOException e) {
System.out.println("An error occurred");
e.printStackTrace();
}
Scanner sc = new Scanner(System.in);
System.out.println("Enter SWF file name");
s = sc.nextLine();
try {
FileWriter myWriter = new FileWriter("Flash Loader.html");
myWriter.write(starthtml+sc+endhtml);
myWriter.close();
System.out.println("Successfully wrote to the file");
} catch (IOException e) {
System.out.println("An error occurred");
e.printStackTrace();
}
}
}
错误:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at CreateFile.main(Flash_Loader_Creator.java:10)
将我的 .java 文件重命名为 CreateFile.java 解决了这个问题谢谢 https://whosebug.com/users/1081110/dawood-says-reinstate-monica https://whosebug.com/users/1902512/haibrayn-gonz%c3%a1lez