|
file not found outside of Netbeans
Hi All,
I have created a java project within Netbeans that uses a perl script as an external resource. The perl script executes as expected when the project is run within Netbeans. However, when I run the generated jar file outside of netbeans it does not find the perl script.
Here is the part of the code that Im using to execute the perlscript:
URL perlURL = getClass().getResource("resources/test.pl");
File f=new File(perlURL.toString());
try {
Process proc=Runtime.getRuntime().exec("perl "+perlURL.getPath());
BufferedReader input=new BufferedReader(new InputStreamReader(proc.getInputStream()));
...
Process error:
Can't open perl script "file:/home/tota/NetBeansProjects/DesktopApplication1/dist/DesktopApplication1.jar!/desktopapplication1/resources/test.pl": No such file or directory
I have also tried using perlURL.getFile() and perlURL.getPath().
The project includes 2 folders, the “myProject “ folder which contains the *.class files and a “resources” folder containing the perl files. The resource file is a subfolder in the myProject folder.
I would appreciate any kind of help with this!
|