aspose file tools*
The moose likes Beginning Java and the fly likes Class Import Can't be Resolved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Class Import Can Watch "Class Import Can New topic
Author

Class Import Can't be Resolved

Jeremy Severson
Greenhorn

Joined: Sep 15, 2010
Posts: 13
Hey All,

I created a class that I want to use for encrypting a string with RC4 and then return the encrypted string only problem is I seem to be having trouble getting the class to import. I am not sure if my import statement is wrong or if there is an issue with my class.

So I put my compiled class file into 'WEB-INF/classes' folder and here is the class code (code is sloppy now but I will clean it up once I have my class working),


Then in my jsp file this is what I put,


But when I run the jsp this is what I get (had to use code tag because of abbreviation rule on forum),


I am guessing it is something simple that I am doing wrong but can't seem to figure out what it is. Any help is appreciated.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

Did you put your RC4 class into a package? If you didn't, then that's your problem. A class which is in a package (e.g. your JSP) can't import a class which isn't in a package.

So put it in a package. And remember that you then have to build a directory structure under WEB-INF/classes which corresponds to that package.
Jeremy Severson
Greenhorn

Joined: Sep 15, 2010
Posts: 13
I did not put the class in a package. So i added it to one and update the folder structure in the WEB-INF/classes directory and now it works great.

Do you always have to have your classes in a package? I thought that if I did not have a package set that I could use the class name only for the import.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class Import Can't be Resolved