Wrong Folder When Running Simulator with Embedded Font

13 views
Skip to first unread message

flash...@gmail.com

unread,
Apr 16, 2014, 11:32:26 AM4/16/14
to codenameone...@googlegroups.com
When I run the simulator with a font placed in the src folder (with the .res), it instead looks in "C:\Program Files\Java\jdk1.8.0\jre\bin\src\" for the font instead of a relative path which results in a file not found error. Why is it looking in this folder, and how can I fix this? Thanks.

Shai Almog

unread,
Apr 16, 2014, 3:15:11 PM4/16/14
to codenameone...@googlegroups.com, flash...@gmail.com
Which IDE are you using?
Does that happen if you pick JDK 7 as your VM?

flash...@gmail.com

unread,
Apr 16, 2014, 3:46:56 PM4/16/14
to codenameone...@googlegroups.com, flash...@gmail.com
I'm using Netbeans 1.8.0. No matter what JDK I use, it seems to always looks in the jdk1.8.0 folder. Maybe it's because of something to do with my environment variables... even though neither my path or CLASSPATH variable have a directory that goes in "\jdk1.8.0\jre\". I should note that I'm relatively new to Java and I'm not sure if setting Source/Binary Format in Project Properties is the same as what you're asking about, but that's what I did to test it with JDK 7.

Shai Almog

unread,
Apr 17, 2014, 12:38:12 AM4/17/14
to codenameone...@googlegroups.com, flash...@gmail.com
No. You need to actually go to the JDK download page at Oracle and download JDK 1.7 then install it.
The in NetBeans select the add platform button and pick that JDK as an option.

flash...@gmail.com

unread,
Apr 17, 2014, 4:40:29 AM4/17/14
to codenameone...@googlegroups.com, flash...@gmail.com
On Thursday, April 17, 2014 12:38:12 AM UTC-4, Shai Almog wrote:
No. You need to actually go to the JDK download page at Oracle and download JDK 1.7 then install it.
The in NetBeans select the add platform button and pick that JDK as an option.

Alright, I did that and set it as the platform but it still looks in jdk1.8.0 for the fonts. 

Shai Almog

unread,
Apr 17, 2014, 2:34:42 PM4/17/14
to codenameone...@googlegroups.com, flash...@gmail.com
I looked at the code and it indeed does look at the src folder for the current directory but it does a file.exists() check first so this should fail and then fallback to the "proper" getResourceAsStream code.
What exactly are you getting as an error?
Do you have an exception stack trace or any additional information on the error?

flash...@gmail.com

unread,
Apr 17, 2014, 2:46:00 PM4/17/14
to codenameone...@googlegroups.com, flash...@gmail.com
When I press the Simulator button in the designer I get: "Error While Running In Simulator: java.lang.RuntimeException: The file wasn't found: C:\Program Files\Java\jdk1.8.0\jre\bin\src\*fontnamehere*"

The error is because the font isn't found, and I don't want it to be in that location, I want it to look in the src folder of the project. 

Shai Almog

unread,
Apr 17, 2014, 2:59:34 PM4/17/14
to codenameone...@googlegroups.com, flash...@gmail.com
OK. I missed the title section where you said the simulate button in the designer... I thought it was when running the app.
We'll have to look into this. Please file an issue on that.
Reply all
Reply to author
Forward
0 new messages