String cannot be resolved to a type - Java RAD
Asked Answered
C

7

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

Codex answered 4/10, 2011 at 17:29 Comment(0)
R
46

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.

Rosenquist answered 4/10, 2011 at 17:40 Comment(8)
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 youCodex
How? After double clicking on the node: ' Unable to resolve JRE: WebSphere v5.1 JRE (Standard VM)'Codex
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 JRERosenquist
@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).Rosemare
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!Codex
@Ted: It's more about eclipse than RAD, go the route at.Cygnusx1 desribed.Rosemare
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/Codex
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.!Rosenquist
W
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.

Winifred answered 22/7, 2016 at 11:4 Comment(0)
W
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.

Washwoman answered 2/5, 2018 at 19:42 Comment(0)
A
1

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

Adumbrate answered 27/5, 2017 at 17:52 Comment(0)
I
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.

Imf answered 10/8, 2018 at 3:17 Comment(0)
R
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) { }

Revisionism answered 30/4, 2020 at 0:48 Comment(0)
U
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.

Ute answered 15/4, 2023 at 12:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.