Results 1 to 1 of 1
- 06-21-2008, 10:10 PM #1Member
- Join Date
- Jun 2008
- Rep Power
file not found outside of Netbeans
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());
Process proc=Runtime.getRuntime().exec("perl "+perlURL.getPath());
BufferedReader input=new BufferedReader(new InputStreamReader(proc.getInputStream()));
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!
- By teamkeff in forum New To JavaReplies: 6Last Post: 06-23-2008, 10:17 PM
- By nvidia in forum NetBeansReplies: 2Last Post: 05-28-2008, 09:31 PM
- By alam99 in forum EclipseReplies: 0Last Post: 01-08-2008, 08:21 AM
- By mary in forum Java ServletReplies: 5Last Post: 11-07-2007, 10:15 AM
- By tamayo in forum New To JavaReplies: 1Last Post: 07-23-2007, 08:23 AM