I'm kinda new to java and trying to create files to test uploads with in Katalon Studio on debian 9.
My Class looks like:
public class Application {
public static void main(String[] args) {
try {
File file = new File("/home/timo/Downloads/example.txt");
BufferedWriter output = new BufferedWriter(new FileWriter(file));
output.write("Hello World");
output.close();
} catch ( IOException e ) {
e.printStackTrace();
}
}
}
And I'm calling it with:
import java.io.File;
import java.io.FileWriter;
Application files = new Application();
I don't get an error but the file also ain't at the specified path.
Static main method is an entry point of a java program. It is not obvious where do you call it from. But typically, you should compile your application that contains your Application
class using compiler, like this:
javac Application.java
and run it as a java application like
java Application
Or using your IDE.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.