1

I imported a web reference and from that service i got some classes and one of classes show error like java.rmi.Remote cannot be resolved to a type. I'm new to this web services so can any one help me to get out of this.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
nag
  • 920
  • 6
  • 27
  • 51

3 Answers3

1

What JDK are you using? What does java -version print? At what phase are you getting this error? and what is the exact error? not just what is it 'like'? If it's an exception please post the entire stack trace.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • jdk 1.6 and i'm using eclispe idigo IDE, it showing red cross mark on the file where error get in project explorer. – nag Aug 29 '11 at 10:17
  • @ng I can't see your red cross marks. 'The file where error get' means nothing to me. – user207421 Aug 29 '11 at 10:26
  • i generated classes from .net web service by using import web reference option in eclipse IDE 2.1 version and i used those classes in eclipse IDE indigo (latest one) so one of in that classes showing error i.e. that error class having a method of return type java.rmi.remote in that return type i'm getting this error. – nag Aug 29 '11 at 10:35
  • @nag I am going to ask this one more time. What is the *exact* error message? Cut and paste please, not 'like' or 'i.e.'. – user207421 Aug 29 '11 at 19:01
-1

This is very often problem bind with JSExJEE. I changed my Project to Maven to avoid download libraries manually (in Eclipse it is very easy: Project - right click -> configure -> Maven). Then added to pom.xml support for Java EE:

  <dependencies>
      <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
      </dependency>
  </dependencies>

Check if there is JRE System library set on JDK (In my case Oracle 1.7.0.71) Not JRE. You must have JAVA JDK installation rather than Java JRE (Project - right click -> Properties -> Java Build Path).

Similar solution: error: package javax.servlet does not exist

Community
  • 1
  • 1
hariprasad
  • 555
  • 11
  • 20
-2

the compiler is telling you that it does not know what Remote is. insert the following like at the top of your source file (but after the package line if you have one).

import java.rmi.Remote;

Ray Tayek
  • 9,841
  • 8
  • 50
  • 90
  • But it doesn't giving me that class when i type "rmi" and one more thing is it is automatically generated class from .net web service. – nag Aug 29 '11 at 08:19
  • The compiler has already mentioned 'java.rmi.Remote'. The import statement won't help. – user207421 Aug 29 '11 at 08:23
  • it is automatically generated class file and i'm using jdk 1.6 but in some sites i've seen that this should work with jdk 1.4 or lower and i already downloaded 1.4 and installed but still i'm having same problem. – nag Aug 29 '11 at 09:37