0

I'm developing a custom plugin for Eclipse and I have a powerpoint file named "extract.ppt" that I want to open through my source code.

When I place the file on my projects root diercotry and use:

File file = new File("/extract.ppt");

the file opens just fine.

But since im gonna be using a few more files on my application, I thought it would be a good idea to keep them all organised under a folder. So I created a folder named "files" under my main project folder and tried to use:

File file = new File("/files/extract.ppt");

but I get an error saying the file does not exist. I checked my Eclipse project's folder and the folder "files" as long as the "extract.ppt" are there.

Any ideas?

fanulis
  • 175
  • 1
  • 1
  • 9

2 Answers2

0

Use this instead:

File file = new File(".\\files\\extract.ppt");

The ".\\files\\..." is like saying LOOK on current directory IN folder files IN ...

TheCrafter
  • 1,909
  • 2
  • 23
  • 44
0

You should use relative path:

File file = new File("./files/extract.ppt");

the files folder should be under the project. Just like .setting or bin folder

ROROROOROROR
  • 959
  • 1
  • 14
  • 31