We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Processing 1.1 file paths failing
Page Index Toggle Pages: 1
Processing 1.1 file paths failing (Read 2915 times)
Processing 1.1 file paths failing
Mar 12th, 2010, 8:03pm
 
Many of my file paths are failing in Processing 1.1.  All the files exist and the paths exist in the sketch.  It works fine in Processing 1.09.
Code:
mainlogo = loadImage("bin/main.png");
logo = loadImage("bin/logo.png");
button = loadImage("bin/button3.png");
font = loadFont("Tahoma-32.vlw");

My bin directory is a subdirectory in the data folder.

The file "bin/main.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file "bin/logo.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
The file "bin/button3.png" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
java.lang.NullPointerException
     at java.io.DataInputStream.readInt(DataInputStream.java:370)
     at processing.core.PFont.<init>(PFont.java:289)
     at processing.core.PApplet.loadFont(PApplet.java:4060)
     at Helios.draw(Helios.java:99)
     at processing.core.PApplet.handleDraw(PApplet.java:1594)
     at processing.core.PApplet.run(PApplet.java:1496)
     at java.lang.Thread.run(Thread.java:637)
processing.app.debug.RunnerException: RuntimeException: Could not load font Tahoma-32.vlw. Make sure that the font has been copied to the data folder of your sketch.
     at processing.app.Sketch.placeException(Sketch.java:1565)
     at processing.app.debug.Runner.findException(Runner.java:568)
     at processing.app.debug.Runner.reportException(Runner.java:543)
     at processing.app.debug.Runner.exception(Runner.java:498)
     at processing.app.debug.EventThread.exceptionEvent(EventThread.java:367)
     at processing.app.debug.EventThread.handleEvent(EventThread.java:255)
     at processing.app.debug.EventThread.run(EventThread.java:89)
Exception in thread "Animation Thread" java.lang.RuntimeException: Could not load font Tahoma-32.vlw. Make sure that the font has been copied to the data folder of your sketch.
     at processing.core.PApplet.die(PApplet.java:2536)
     at processing.core.PApplet.die(PApplet.java:2545)
     at processing.core.PApplet.loadFont(PApplet.java:4063)
     at Helios.draw(Helios.java:99)
     at processing.core.PApplet.handleDraw(PApplet.java:1594)
     at processing.core.PApplet.run(PApplet.java:1496)
     at java.lang.Thread.run(Thread.java:637)
Re: Processing 1.1 file paths failing
Reply #1 - Mar 13th, 2010, 2:48am
 
I cannot reproduce that on Windows XP Pro SP3.
Re: Processing 1.1 file paths failing
Reply #2 - Mar 13th, 2010, 4:20am
 
Try this
Code:

mainlogo = loadImage("\\bin\\main.png");
logo = loadImage("\\bin\\logo.png");
button = loadImage("\\bin\\button3.png");
font = loadFont("Tahoma-32.vlw");

Re: Processing 1.1 file paths failing
Reply #3 - Mar 13th, 2010, 7:43am
 
andrewowaun, jeffg didn't tell he was on Windows, forward slashes always worked on all platforms (including Windows) and giving absolute paths is a bad idea (since these are relative paths).
Re: Processing 1.1 file paths failing
Reply #4 - Mar 13th, 2010, 8:14am
 
Thanks, Philho. I was trying to find out what was the universal method.
Re: Processing 1.1 file paths failing
Reply #5 - Mar 13th, 2010, 8:40am
 
No problem, all ideas are welcome, but I prefer to point out issues in some of them...
Re: Processing 1.1 file paths failing
Reply #6 - Mar 13th, 2010, 6:03pm
 
Figured out the issue... I had this in my sketch.  Opps
Code:
static public void main(String args[]) {
PApplet.main(new String[] {
"--bgcolor=#000000", "sketch"
}
);
}

It worked in 1.09 but doesn't in 1.1.  Oh well.. I can live without it.
Re: Processing 1.1 file paths failing
Reply #7 - Mar 14th, 2010, 1:16pm
 
Ah, thanks a lot! Most of my examples had the same problem (I need the main class for application export and left it in the code for convenience, but now it breaks the code when called from the PDE).

The fact that the sketch then fails because it cannot load files from the data directory is a bit confusing...

Andreas
Page Index Toggle Pages: 1