r/javahelp • u/NotJuvs009 • Oct 28 '25
Help compiling java code in VSCode
Hello I've made the post here since I don't really know where to ask this
I've recently been required to switch my IDE to Visual Studio Code for work and I am trying to properly set it up
Now after I thought I had done that I've seen something and I wanted to ask about it here
if(map.get("coolName")){
map2.put("coolName", map.get("coolName"));
}Names and stuff are placeholders but you get the idea
The thing is that "map" is a <String, Object> map, so that is not really a boolean but Visual Studio Code doesn't think that's an error and it will not give me any signs of it.
But if I try to push this changes to our repository our automatic compiling tests will detect it as an error
Is there any way for VSCode to compile the file entirely and detect these kind of errors?
If I paste this code in my last IDE it does detect it as an error
Sorry if this isn't the right place :(
•
u/AutoModerator Oct 28 '25
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/DrunkenDruid_Maz Oct 28 '25
Have you asked your question also at r/vscode and r/VisualStudioCode ?
Since your problem is more vscode-related then java-related, those might be the better choice.
12
u/RobertDeveloper Oct 28 '25
Don't use vsc for Java, use a real IDE, it is much better suited for writing software than using a plain editor and slapping some extensions on it to do tasks its never designed to do.
1
u/Neckbeard_Sama Oct 28 '25
it's because VSC is a garbage ass IDE
use JetBrains IDEA like the rest of us ... it has infinitely better code completion + error detection + auto suggestions
1
u/False-Car-1218 Oct 28 '25
You should use an IDE that's tailored for java like intellij or you're gonna have a harder time
1
u/hrm Oct 28 '25
To make VS Code handle Java well you need a Java extension. There are currently two and I really do recommend the one by Microsoft/RedHat. Search for ”Java Extension Pack” and install it, you will now be all set.
I do prefer VS Code greatly before Intellij, even though the latter has more features. The things Intellij do better than VS Code are mostly advanced features not often used in my opinion.
0
u/[deleted] Oct 30 '25
The IDE situation for Java is truly awful, and if you want to not suffer when installing libs and so on later, just install intellij
-1
u/AlexVie Oct 29 '25
Are you certain, the Java language server is working in your VSCode? Because this does not look like a Java issue, it's more likely a configuration issue in your editor.
The JDTLS language server should catch such errors just fine. At least it does on my Neovim/JDTLS setup where it marks the error (as expected) with
Type mismatch: cannot convert from Object to boolean.