Bug 1505 : File paths failing - Processing 1.1
Last modified: 2010-03-13 17:53




Status:
RESOLVED
Resolution:
INVALID -
Priority:
P2
Severity:
normal

 

Reporter:
jeffg
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2010-03-12 20:06
Processing 1.1
OSX 10.6.2

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");[/CODE]
[color=#ff0000]
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)
[/color]
Additional Comment #1 From fry 2010-03-13 02:45
please attach a sketch that has the problem.
Additional Comment #2 From jeffg 2010-03-13 05:37
I found out what is causing the issue. I have this in my sketch, which 1.1
doesn't like.

static public void main(String args[]) {
PApplet.main(new String[] {
"--bgcolor=#000000", "sketch"
}
);
}
Additional Comment #3 From fry 2010-03-13 13:00
see revisions.txt:

+ If you overwrite PApplet.main(), you're responsible for what happens.
http://dev.processing.org/bugs/show_bug.cgi?id=1446

if you don't know what main() does, then it shouldn't be in your sketch.
Additional Comment #4 From jeffg 2010-03-13 14:19
Ben, this is taken directly from your example:
http://processing.org/reference/environment/#PDE

To quote you
"If running in "Java" mode, where your code starts "public class blah
extends PApplet", you'll need to write your own main() method in order for
Export to Application to work. It should look something like this:

static public void main(String args[]) {
PApplet.main(new String[] { "YourClassName" });
}

Not doing this, or using your own main can cause problems internally with
variables not being properly set up. If you opt not to use PApplet.main(),
make sure you read the source code for it so that you understand how it
works, and don't whine if it breaks."

Personally, I don't need it. I'm just letting you know that it worked in
the last version. These are your examples and it no longer works. If
that's your intent, I'm fine with that... just letting you know.
Additional Comment #5 From fry 2010-03-13 17:53
no, you aren't writing a java mode application that includes "public class
xxx extends PApplet", as described in that link. don't use a main() method.
the point is that if you think you know what you're doing, and extend
PApplet, then you have to add main() yourself. but you don't, and you're
not, so it's not a case where you should have a main() method.