Reputation: 861
I have one lib/ folder inside my Eclipse Plugin Project and on this folder I have a little script... But when I run the 'Eclipse Plugin Project' I cannot execute that script because I cannot access to that folder...
How can I fix this?
-- Thanks in advance
Upvotes: 0
Views: 65
Reputation: 328556
If you can execute the script by passing an InputStream
or a String
to the interpreter, put in the src/
folder, so it ends up on the classpath and use getClass().getClassLoader().getResourceAsStream("script-name")
to get an InputStream
If the interpreter is external (like bash
or something that doesn't implement the Java Scripting API), do the same. When you need to execute the script, create a stream and copy the script to a temporary file.
Keeping the script in lib/
is also a bad idea since the plugin will be assembled into a single JAR file unless you turn that off, so you will end up with a script file inside of a JAR - again something which most interpreters can't use.
By using the classpath, you can let Eclipse figure out where the data is.
Upvotes: 1