The term "java file" is a bit confusing. It sounds like you want to execute a script using the Java Runtime.exec() method.
To get the output into the calling Java app, just reassign the stdout stream that the Runtime.exec will write to. You can probably stream to a StringBuffer. Then, when the script has returned, get the results from the StringBuffer.
An IDE is no substitute for an Intelligent Developer.