Question: i have created a Java program in Eclipse, it manipulates data and outputs a new file.txt when i run it in Eclipse it works perfectly,

i have created a Java program in Eclipse, it manipulates data and outputs a new file.txt

when i run it in Eclipse it works perfectly, however when i get the executable .jar file and run it using "java -jar filename.jar" in windows cmd

it works perfectly, but it doesn't output the file that it does inEclipse.

i'm lost here i don't know what's the problem, i tried using apache fileutile, file writer, nothing works,

i even let eclipse get the absolutepath() but still to no avail.

here's the code that creates the file:

File f1= new File(name);

String filePath = f1.getAbsolutePath();

String fileName=filePath.replace(extension, "");

File file = new File(fileName+"_new.txt");

FileWriter writer1 = new FileWriter(file);

try { writer1.write(read.disasembler); writer1.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }

plese help

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!