• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic