aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Using a .class file without a .java source file in Netbeans - java cannot find symbol Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Using a .class file without a .java source file in Netbeans - java cannot find symbol" Watch "Using a .class file without a .java source file in Netbeans - java cannot find symbol" New topic
Author

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

Dav Me
Greenhorn

Joined: Apr 17, 2009
Posts: 1
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

Joined: Sep 11, 2006
Posts: 959

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.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using a .class file without a .java source file in Netbeans - java cannot find symbol