reset password
Author Message
ahorejs
Posts: 7
Posted 06:24 Dec 01, 2017 |

How do we make the PPMImage class visible to classes in our project? I have placed the .class file in my bin folder and src folder and it is still not visible

ifiguer
Posts: 27
Posted 09:06 Dec 02, 2017 |

I had the same trouble when importing, so I just decompiled the .class file. Maybe that's the way you're supposed handle the file? But, I don't think so since you can import .class files into project and add them to the libraries in your build path. It should work, but I didn't have any luck.

TonyOs1
Posts: 13
Posted 17:48 Dec 03, 2017 |

"DO NOT decompile my code and make changes.  This may cause you to get a 0 on the project."

From one of the links on the site.

Last edited by TonyOs1 at 17:48 Dec 03, 2017.
ifiguer
Posts: 27
Posted 18:39 Dec 03, 2017 |
TonyOs1 wrote:

"DO NOT decompile my code and make changes.  This may cause you to get a 0 on the project."

From one of the links on the site.

Well, I believe that only applies if you alter the code. Do you have any input on how to use the .class file?

hcainho
Posts: 8
Posted 10:55 Dec 05, 2017 |

I put in in a new JAR file, then imported that into the project, and that works for me. When I was importing the .class file by itself, it was in the default package, which I think prevents it from being called by classes in a named package. As a JAR, it's in a named package.

ifiguer
Posts: 27
Posted 22:59 Dec 05, 2017 |
hcainho wrote:

I put in in a new JAR file, then imported that into the project, and that works for me. When I was importing the .class file by itself, it was in the default package, which I think prevents it from being called by classes in a named package. As a JAR, it's in a named package.

Just realized that you can create a project with a default package (the one the PPMImage.class uses).  So the trick is to create all of your classes in the default package and solely use that package then add a class folder in your project directory (outside of source) just like you would for lib folder of .jar files. Add the PPMImage.class file into the class folder. Refresh the project, then configure the build path for your project so that the class folder is added with PPMImage.class file already inside. Same method for the .jar, but instead of adding a class folder you add .jar needed to view PPM images. This avoids doing any unnecessary steps for using the .class file in your project.