15

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
  • 552
  • 3
  • 14
  • 34

7 Answers7

44

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.

Cygnusx1
  • 5,329
  • 2
  • 27
  • 39
  • 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 Oct 04 '11 at 17:47
  • How? After double clicking on the node: ' Unable to resolve JRE: WebSphere v5.1 JRE (Standard VM)' – tmaurst Oct 04 '11 at 17:51
  • 3
    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 – Cygnusx1 Oct 04 '11 at 17:55
  • @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). – home Oct 04 '11 at 17:56
  • 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! – tmaurst Oct 04 '11 at 17:59
  • @Ted: It's more about eclipse than RAD, go the route at.Cygnusx1 desribed. – home Oct 04 '11 at 18:13
  • 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/ – tmaurst Oct 04 '11 at 18:34
  • 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.! – Cygnusx1 Oct 04 '11 at 18:51
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.

2

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

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.

1

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.

rohit thomas
  • 2,302
  • 11
  • 23
Juan
  • 11
  • 2
0
error- string cannot be resolved to a type

Here in the declaring the method "string" in bold is lower case. Change string to upper case. Example: public static string howManyPass(double grd1, double grd2) { }

0

For Spring Boot users, please check your pom.xml file as what are the dependencies you've added in latest. For me the problem was gone once I removed some dependencies.