Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using a .class file without a .java source file in Netbeans - java cannot find symbol

 
Dav Me
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a precompiled utility class that was provided by the professor. It is named Utility.class and has a few premade functions we can call.

It works fine in the simple tool we use at school, but when I try to use it with a project in netbeans, I get java cannot find symbol error.

I've copied it into the folder with my source files:
.\My App\src\myapp

The package name is myapp, so I've tried adding:
import myapp.Utility.*;

...but it didn't make any difference.

I tried placing it into:
.\My App\build\classes

...and it gets erased when I build.

I edited the project properties and selected Libraries, thinking I should be able to make a reference in there, but that seems to want a folder of precompiled jar files and I'm not sure how to make the transition.

I'm just stumped.

Does anyone have any clue where to put a .class file so my app can find a ref to it in netbeans?

Thanks,
Dav
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. In the Project, right click LibrariesAdd Jar/Folder.
2. Add the folder that contains your Java classes.
Suppose your classes are in the myapp package and you put them in the /home/user/myapp/classes/myapp/*.class, then you need to select /home/user/myapp/classes and NOT /home/user/myapp/classes/myapp/. If you understand the classpath concept, you should know why

Hope that helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic