0

i'm using one vbscript file to convert mass excel files into txt files.It is working fine.

I want to do the same operation through the java code . I'm trying to execute the file from java code like

 try {
            Runtime.getRuntime().exec("wscript C:\\Datas\\xl2tab.vbs");
        } catch (IOException ex) {
            Logger.getLogger(convertFile.class.getName()).log(Level.SEVERE, null, ex);
        }

I'm getting an error like

enter image description here

Anyone have an idea to run the script file from java code..?

2
  • Excuse me for stating the obvious: It is running wscript, and it is running your VBS script. Within the VBS script it is failing to find the file that it mentions. It fails at line 52. We can't really guess what is going wrong inside the script without a listing… Commented Jul 19, 2013 at 9:08
  • 1
    The script is running. Have you looked into the possible causes mentioned in the error message? Commented Jul 19, 2013 at 9:24

1 Answer 1

1

The problem is that the script takes current directory for converting excel files.As i'm running the java code from Netbeans, it takes the netbeans project folder as current directory and trying to convert.

I solved by passing the folder path(where files are placed for conversion) as parameter variable to script.

Now i can run the script from java code.So, it is better to use variables for folder path ..

Sign up to request clarification or add additional context in comments.

Comments

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.