String cannot be resolved to a type - Java RAD

88,881

Solution 1

My guess is you miss the JRE Runtime Library in your project. But this would cause all the java.* classes to generate this message! Can you post your code so we can see what might be the problem?

try doing :

right-click on your project. ->properites ->java Build Path ->tab Librairies

check if the JRE System Library is there.

Solution 2

I don't know if this helps anyone, but here I go. I had the same problem just now in Visual Studio Code (I am on Linux). On my java.home, I had the options in my directory of:

  • /usr/lib/jvm/java-8-openjdk-amd64
  • /usr/lib/jvm/java-1.8.0-openjkd-amd64

I had the first one as default, but when I switched to the second one, it all started working properly.

Solution 3

i am a beginner. i am using Eclipse and got stuck at the Hello World code. Got same error description and also error stating can't resolve 'system'.

After staying frustrated for few hours, as I checked JRE library path and stuff, I just Capitalized 'S' of 'string' and 'system'.. and bang.. problem solved. I hope this helps.

Solution 4

Another way to solve this problem is in the following way.

Right click on the project-->properties-->Java build path-->go to the library option

and delete or remove the library that is in error, after this you select add library and download the library that you deleted and ready.

Solution 5

You need to capitalize the "s" in the string.

Share:
88,881
tmaurst
Author by

tmaurst

Updated on July 05, 2022

Comments

  • tmaurst
    tmaurst almost 2 years

    I've recently started developing in Java (coming from .Net). The IDE I am using is RAD 7.3.

    After importing a project, which I need to do some enhancements on, I am receiving this error:

    "String cannot be resolved to a type"

    This applies to all variables of the String data type, as well as any methods that take string arguements. I'm very inexperienced with Java so I'm not sure how to go about fixing this. My guess is that it has something to do with the way RAD was installed, and that required libraries are missing. Again, not sure how to address that.

    Any help or guidance would be much appreciated! Thank you

  • tmaurst
    tmaurst over 12 years
    JRE System Library[WebSphere v5.1 JRE](unbound) is what is listed...There is a huge amount of code in the project, not sure what to post for you
  • tmaurst
    tmaurst over 12 years
    How? After double clicking on the node: ' Unable to resolve JRE: WebSphere v5.1 JRE (Standard VM)'
  • Cygnusx1
    Cygnusx1 over 12 years
    ok forget about the code... your problem is related to configuration. in the tab i asked you to go try to click button "Add Library..." then choose a valid JRE
  • home
    home over 12 years
    @Ted: If you migrated from a RAD version which included WAS 5.1 to another RAD version like 8.0, the WAS libs are not available any more. As at.Cygnusx1 suggested, you must manually go through the projects and resolve those dependencies (bind to your WAS version, like 8.0).
  • tmaurst
    tmaurst over 12 years
    I'm completely new to RAD, as well as Java project architecture. Can you point me in the right direction as to how to begin this binding process? Thank you!
  • home
    home over 12 years
    @Ted: It's more about eclipse than RAD, go the route at.Cygnusx1 desribed.
  • tmaurst
    tmaurst over 12 years
    After going to 'Add Library' then selecting the default JRE [jdk] library, the String problem was resolved. Great! However I'm now left with errors regarding missing jar files: ivjejb35, j2ee, runtime, and servletevent. It is looking in WAS_50_PLUGINDIR/lib/
  • Cygnusx1
    Cygnusx1 over 12 years
    for j2ee, its in the same Java build path-> Libraries panel. Add a Web App Libraries, and probably a WebSphere Application Server vx.x. You will probably need the EAR Libraries too.!