File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes doesn't like an import statement in a j2ee tutorial app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "doesn Watch "doesn New topic
Author

doesn't like an import statement in a j2ee tutorial app

Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
Hi
I downloaded the Sun J2EE tutorial bundle and I've installed it and now I'm try to compile it with ant, following the included instructions.
The compiler trips up on a line in one of the example classes in a subdirectory called \src\ejb\confirmer where there are 4 files:
Confirmer.java
ConfirmerClient.java
ConfirmerHome.java
ConfirmerBean.java
and it says:
D:\java\j2eetutorial\examples\src\ejb\confirmer\ConfirmerClient.java:14: '.' expected
import Confirmer;
^
I'm not quite sure what the problem is - either it can't find the class in the same directory (which I think means I need to put it in my CLASSPATH? How do I do that in NT?) or something else entirely.
I'd appreciate any feedback.
Regards
Adam Hardy


I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 565
I played around with it and found that if I remove those offending import statements, it compiles.
But then it falls over on the next file, with exactly the same type of import statement.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4419
    
    5

is there a package statement? If not, you could try adding an appropriate one such as:
package ejb.confirmer;
in all those files. I can't think of any other reason though.
Junilu


Junilu - [How to Ask Questions] [How to Answer Questions]
Jason Ford
Ranch Hand

Joined: Aug 02, 2001
Posts: 54
Are you using the beta version of Java SDK 1.4? I had some trouble with some of my import statements when I switched from 1.3. I think the problem is that it doesn't make sense to import a class into another class when they are both in the same default package. The updated compiler recognizes this error, because it expects that every import statement will include a '.'. For example:
import java.io.*; // This is ok
import aClassInSamePackage; // This is NOT ok
I wrote a perl script to fix this problem in the code I'm maintaining, since there are over 60 .java files in the program. It pulls out the bad import statements. If you would like the script, email me and I'll send it to you.


SCJP, SCWCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doesn't like an import statement in a j2ee tutorial app
 
Similar Threads
importing javax.ejb
Server for EJB...with Tomcat?
EJB jar files?
JBoss EJB3 WebService Sample
problem when buikding with ant in j2ee tutorial