File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes creat file .txt in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "creat file .txt in java " Watch "creat file .txt in java " New topic

creat file .txt in java

wafa khan
Ranch Hand

Joined: Apr 29, 2013
Posts: 42
hi all of you

i creat a .bat to test an application java on unit of command , i write this in file .txt
java -jar
and i rename the file exec.bat it working but the black window disppeared quickly what can i write to still the window opened
thank you
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15081

wafa khan wrote:java -jar

If that is exactly what you put in your .bat file, it is not going to work. Instead of the name of a source file (, you need to specify the name of a JAR file. I guess you already know that, because you say it already works. But note that you need to be precise with what you write on the forum here.

To make the console window stay after your program has finished, add a 'pause' command at the end of the batch file. So, the contents of your .bat file might look like this:

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
wafa khan
Ranch Hand

Joined: Apr 29, 2013
Posts: 42
thank you for your help .. it's right
I agree. Here's the link:
subject: creat file .txt in java
It's not a secret anymore!