0

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.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.