I am trying to re-use the code in different technology stack. Let's say: I have a jar which contatins followng class defination:
package com.gallop;
import java.io.File;
import java.io.IOException;
public class GenerateFile {
public void generateFile(String fileName)
{
File file = new File(fileName);
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Now, the code is exported to filegenerator.jar.
Now, question is how can i use the class inside filegenerator.jar to create a file using javascript. Basically, I have import GenerateFile class for jar. I have to create instance of GenerateFile. Then using instance of GenerateFile, i should be able to invoke method generateFile with filePath as parameter.