3

There are two requirements,

  • Locate and Run a .m (Octave script) using Java
  • Take the output and use it in the program.

This is how my files are

I tried putting them in different folders and it didn't work.
Files Structure

This is how I want to use them.
Code of Using files

How do I access them in Netbeans IDE 8.2?


Edit for Clarification:
The presumed duplicate doesn't solve my problem. It tell us how to import an image. What I am doing here is running a script directly which is stored somewhere in my project files.

Tarun Maganti
  • 3,076
  • 2
  • 35
  • 64
  • What is data.txt? Where is it located? Where do your `.class` files go? Using `./` would look in the current directory from where the program is run which is usually one level above the package structure. – Chetan Kinger Jan 21 '17 at 07:59
  • 1
    Possible duplicate of [How to correctly get image from 'Resources' folder in NetBeans](http://stackoverflow.com/questions/6845231/how-to-correctly-get-image-from-resources-folder-in-netbeans) – OneCricketeer Jan 21 '17 at 08:04

1 Answers1

0

As per the netbeans directory project structure, you need to create one resources directory. Then put your files there in resource directory.

Please update your code like below.

Put your file under /resources/, then use it like below.

ProcessBuilder pb= new ProcessBuilder("resources/ProcessImg.m");
Path data_file = Paths.get("resources/data.txt")
Maheshwar Ligade
  • 6,709
  • 4
  • 42
  • 59