Maven + IDEA: cannot find String












0















I am trying out the workflow where you create and maintain your project primarily in Maven, and the Intellij IDEA project files are derived from that, which seems to be the recommended way these days.



My setup: Windows 7, JDK 11, Maven 3.6.0, IDEA Community 2018.2.6, the latter three all fairly fresh installs, not messed around with, verified as working in their own right.



https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html followed steps to create a Hello World project, verified it compiles and runs with Maven after adding the project property entries to specify we are not on Java 5 anymore.



Opened the project in IDEA by opening pom.xml and saying yes, this is a project file.



Opened App.java, and references to String are underlined in red: Cannot resolve symbol 'String'.



Tried invalidate caches / restart, no change.



Consensus as far as I can tell is that maven is the top build system and IDEA is the top IDE, so it must be possible to get them to work together. How?










share|improve this question


















  • 2





    This sounds like the project does not have a JDK defined since IDEA cannot find java's own classes. IDEA should ask you to define one on the top of the code area.

    – f1sh
    Nov 26 '18 at 11:05











  • it compiles and runs, but it can't find the String class?

    – Stultuske
    Nov 26 '18 at 11:08











  • @Stultuske Compiles and runs with command line maven, cannot find the String class in the IDE.

    – rwallace
    Nov 26 '18 at 11:08






  • 1





    @f1sh Ah, that was it, thanks! Ctrl-Shift-Alt-S, project settings and specify a JDK there.

    – rwallace
    Nov 26 '18 at 11:11
















0















I am trying out the workflow where you create and maintain your project primarily in Maven, and the Intellij IDEA project files are derived from that, which seems to be the recommended way these days.



My setup: Windows 7, JDK 11, Maven 3.6.0, IDEA Community 2018.2.6, the latter three all fairly fresh installs, not messed around with, verified as working in their own right.



https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html followed steps to create a Hello World project, verified it compiles and runs with Maven after adding the project property entries to specify we are not on Java 5 anymore.



Opened the project in IDEA by opening pom.xml and saying yes, this is a project file.



Opened App.java, and references to String are underlined in red: Cannot resolve symbol 'String'.



Tried invalidate caches / restart, no change.



Consensus as far as I can tell is that maven is the top build system and IDEA is the top IDE, so it must be possible to get them to work together. How?










share|improve this question


















  • 2





    This sounds like the project does not have a JDK defined since IDEA cannot find java's own classes. IDEA should ask you to define one on the top of the code area.

    – f1sh
    Nov 26 '18 at 11:05











  • it compiles and runs, but it can't find the String class?

    – Stultuske
    Nov 26 '18 at 11:08











  • @Stultuske Compiles and runs with command line maven, cannot find the String class in the IDE.

    – rwallace
    Nov 26 '18 at 11:08






  • 1





    @f1sh Ah, that was it, thanks! Ctrl-Shift-Alt-S, project settings and specify a JDK there.

    – rwallace
    Nov 26 '18 at 11:11














0












0








0








I am trying out the workflow where you create and maintain your project primarily in Maven, and the Intellij IDEA project files are derived from that, which seems to be the recommended way these days.



My setup: Windows 7, JDK 11, Maven 3.6.0, IDEA Community 2018.2.6, the latter three all fairly fresh installs, not messed around with, verified as working in their own right.



https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html followed steps to create a Hello World project, verified it compiles and runs with Maven after adding the project property entries to specify we are not on Java 5 anymore.



Opened the project in IDEA by opening pom.xml and saying yes, this is a project file.



Opened App.java, and references to String are underlined in red: Cannot resolve symbol 'String'.



Tried invalidate caches / restart, no change.



Consensus as far as I can tell is that maven is the top build system and IDEA is the top IDE, so it must be possible to get them to work together. How?










share|improve this question














I am trying out the workflow where you create and maintain your project primarily in Maven, and the Intellij IDEA project files are derived from that, which seems to be the recommended way these days.



My setup: Windows 7, JDK 11, Maven 3.6.0, IDEA Community 2018.2.6, the latter three all fairly fresh installs, not messed around with, verified as working in their own right.



https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html followed steps to create a Hello World project, verified it compiles and runs with Maven after adding the project property entries to specify we are not on Java 5 anymore.



Opened the project in IDEA by opening pom.xml and saying yes, this is a project file.



Opened App.java, and references to String are underlined in red: Cannot resolve symbol 'String'.



Tried invalidate caches / restart, no change.



Consensus as far as I can tell is that maven is the top build system and IDEA is the top IDE, so it must be possible to get them to work together. How?







java maven intellij-idea






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 26 '18 at 11:03









rwallacerwallace

9,6642174152




9,6642174152








  • 2





    This sounds like the project does not have a JDK defined since IDEA cannot find java's own classes. IDEA should ask you to define one on the top of the code area.

    – f1sh
    Nov 26 '18 at 11:05











  • it compiles and runs, but it can't find the String class?

    – Stultuske
    Nov 26 '18 at 11:08











  • @Stultuske Compiles and runs with command line maven, cannot find the String class in the IDE.

    – rwallace
    Nov 26 '18 at 11:08






  • 1





    @f1sh Ah, that was it, thanks! Ctrl-Shift-Alt-S, project settings and specify a JDK there.

    – rwallace
    Nov 26 '18 at 11:11














  • 2





    This sounds like the project does not have a JDK defined since IDEA cannot find java's own classes. IDEA should ask you to define one on the top of the code area.

    – f1sh
    Nov 26 '18 at 11:05











  • it compiles and runs, but it can't find the String class?

    – Stultuske
    Nov 26 '18 at 11:08











  • @Stultuske Compiles and runs with command line maven, cannot find the String class in the IDE.

    – rwallace
    Nov 26 '18 at 11:08






  • 1





    @f1sh Ah, that was it, thanks! Ctrl-Shift-Alt-S, project settings and specify a JDK there.

    – rwallace
    Nov 26 '18 at 11:11








2




2





This sounds like the project does not have a JDK defined since IDEA cannot find java's own classes. IDEA should ask you to define one on the top of the code area.

– f1sh
Nov 26 '18 at 11:05





This sounds like the project does not have a JDK defined since IDEA cannot find java's own classes. IDEA should ask you to define one on the top of the code area.

– f1sh
Nov 26 '18 at 11:05













it compiles and runs, but it can't find the String class?

– Stultuske
Nov 26 '18 at 11:08





it compiles and runs, but it can't find the String class?

– Stultuske
Nov 26 '18 at 11:08













@Stultuske Compiles and runs with command line maven, cannot find the String class in the IDE.

– rwallace
Nov 26 '18 at 11:08





@Stultuske Compiles and runs with command line maven, cannot find the String class in the IDE.

– rwallace
Nov 26 '18 at 11:08




1




1





@f1sh Ah, that was it, thanks! Ctrl-Shift-Alt-S, project settings and specify a JDK there.

– rwallace
Nov 26 '18 at 11:11





@f1sh Ah, that was it, thanks! Ctrl-Shift-Alt-S, project settings and specify a JDK there.

– rwallace
Nov 26 '18 at 11:11












1 Answer
1






active

oldest

votes


















1














Open Project Structure (by pressing F4):



enter image description here



Check the SDKs and Problems sections for any error.






share|improve this answer
























  • That works, except on my version the shortcut is Ctrl-Shift-Alt-S (or File menu) and different screen layout. Thanks!

    – rwallace
    Nov 26 '18 at 11:19












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53479745%2fmaven-idea-cannot-find-string%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Open Project Structure (by pressing F4):



enter image description here



Check the SDKs and Problems sections for any error.






share|improve this answer
























  • That works, except on my version the shortcut is Ctrl-Shift-Alt-S (or File menu) and different screen layout. Thanks!

    – rwallace
    Nov 26 '18 at 11:19
















1














Open Project Structure (by pressing F4):



enter image description here



Check the SDKs and Problems sections for any error.






share|improve this answer
























  • That works, except on my version the shortcut is Ctrl-Shift-Alt-S (or File menu) and different screen layout. Thanks!

    – rwallace
    Nov 26 '18 at 11:19














1












1








1







Open Project Structure (by pressing F4):



enter image description here



Check the SDKs and Problems sections for any error.






share|improve this answer













Open Project Structure (by pressing F4):



enter image description here



Check the SDKs and Problems sections for any error.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '18 at 11:12







user10639668




















  • That works, except on my version the shortcut is Ctrl-Shift-Alt-S (or File menu) and different screen layout. Thanks!

    – rwallace
    Nov 26 '18 at 11:19



















  • That works, except on my version the shortcut is Ctrl-Shift-Alt-S (or File menu) and different screen layout. Thanks!

    – rwallace
    Nov 26 '18 at 11:19

















That works, except on my version the shortcut is Ctrl-Shift-Alt-S (or File menu) and different screen layout. Thanks!

– rwallace
Nov 26 '18 at 11:19





That works, except on my version the shortcut is Ctrl-Shift-Alt-S (or File menu) and different screen layout. Thanks!

– rwallace
Nov 26 '18 at 11:19




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53479745%2fmaven-idea-cannot-find-string%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Tonle Sap (See)

I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

Guatemaltekische Davis-Cup-Mannschaft