Wednesday, February 13, 2013

Image creation in j2me

Clarion call: James Gosling should be shot!

Now, developing Java can sometimes be a nightmare, especially so with a Java built IDE like Netbeans and that other stupid Eclipse. Just ran into a problem working with images using Netbeans.


It's odd that different IDEs/SDKs create the JAR file differently. 
I tried several things, but these are the two that worth mentioning: 

1) Put the image file (logo.png) in the root of the "src" subdirectory, and used "/logo.png" as the path in my code.  It worked.
2)Moved the file to the "res" subdirectory and modified the project properties to include that folder when building the solution.  It also worked without changing the path to the image in my code. 

To change the project properties, right click on the project name and click "properties".  Then expand the "Build" node, and click on "Libraries & Resources", and click the "Add Folder" button that appears to the right hand side of the window, to add the "src" folder, click "Ok", and build and run the solution. 
The best thing you can do to investigate this kind of issues, is opening the jar file (you can open it with WinRar or any similar program) to see if the image files are included, and the path where they are.

No comments:

Post a Comment