0

I have included the vbs file in the source package of my project in java. But still I am getting vbscript file not found.

But if I copy and paste the file on Desktop and enter its full path then it's working properly.

I'm a bit confused.

Unable to understand the problem.

1 Answer 1

0

To specify the location of a file or directory we can use absolute path which contains the root directory and all other subdirectories in which a file or folder is contained. For example

  • C:/NetBeansProjects/Myproject/src/myPackage/main.java

is the absolute path to the main.java file. Alternatively we can use relative paths like

  • folder/file.txt
  • src/myPackage/main.java

but you have to be careful when dealing with relative paths because they are fully dependent on the current working directory

Myproject is our working directory if the vbs file is in src folder so the relative path will be

  • src/file.vbs

    File vbsScript = new File("src/file.vbs");

if it is in the src/MyPackage folder (in a package) the relative path will be

  • src/myPackage/file.vbs

    File vbsScript = new File("src/myPackage/file.vbs");

if it is in The Myproject directory which is the working directory the relative path is

  • file.vbs

    File vbsScript = new File("file.vbs");

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.