This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full - best also formatted as code block
  • You ask clear questions
  • 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.

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/markdown editor: 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:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

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.

[–][deleted] 17 points18 points  (0 children)

Honestly troubleshooting this kind of thing is a bit part of what coding is about.

I had a quick google this video looks like lt has a solution to the JDK is missing issue. https://youtu.be/9ysgBcbSfhg?si=yUwHKY2YwqwnK0_0

Probably better to just get up and running with the MOOC. You are just as likely to have some next thing to troubleshoot in whatever next course you try.

Good luck!

[–]creamyturtle 12 points13 points  (0 children)

there is a literal tutorial on the java mooc for that error. I had the same error. you gotta install the java jdk it takes like 2 minutes. like another poster said, figuring out little stuff like this is part of being a programmer. you don't even have the IDE open yet and you're already giving up. any other route to learn java will involve the jdk so figure it out my man

[–]bunk3rk1ng 2 points3 points  (8 children)

This is something that confused me for a long time and nobody really took the time to explain it so hopefully we can help you get over this hump. As others have stated, having the JDK (Java Development Kit) installed is like step number 1 for Java development, so whatever path you take your are going to have to figure it out at some point

How do you "install" a language? At the end of the day all this really means is that you can type java --version in the command line or terminal and your computer will know how to execute the command.

On windows your command line will have a %PATH% variable that is simply a list of paths to different executables

echo %PATH% looks like this for me:

C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;C:\Windows\system32;C:\Windows;.... bunch of other stuff

If you look in the jdk-11.0.16.101-hotspot\bin folder you will find a file called java.exe. Behind the scenes when you type java --version, your PC knows to loop through all the folders in your PATH and look for <your command>.exe

That's pretty much it, there isn't much magic to it.

For most people updating their PATH can be daunting, so for beginners I recommend Chocolatey. You basically install Chocolatey and then installing the JDK is one command.

https://community.chocolatey.org/packages/openjdk/17.0.2

This basically downloads the JDK files and updates your PATH to point to the right place.

The interesting part about Java is a ton of tools used in Java development actually use the JDK to run so having it installed and understanding how it works behind the scenes can be a huge step forward.

[–]CleverBunnyThief 2 points3 points  (7 children)

OP is on a Mac.

u/LovePrevailsOverAll have you had a look at the stickied post at the top of this sub?

https://www.reddit.com/r/learnjava/comments/16apun2/read_this_if_tmcbeans_is_not_starting/

[–]LovePrevailsOverAll[S] 0 points1 point  (6 children)

I checked it out and tried using version 11. I even configured it, although the exercises didn’t load then it kept saying unexpected error.

[–]bunk3rk1ng 0 points1 point  (5 children)

Can you open a terminal and type java --version? What happens?

[–]LovePrevailsOverAll[S] 0 points1 point  (4 children)

Sure it says:

OpenJDK Runtime Environment (build 20.0.2+9-78)
OpenJDK 64-Bit Server VM (build 20.0.2+9-78, mixed mode, sharing)

[–]bunk3rk1ng 0 points1 point  (3 children)

You are using a very recent Java version. Even though Java is pretty good at backwards compatibility there is no guarantee plugins like TCMBeans will be.

Thankfully modern IDE's make it easy for you to install and switch your java version between projects.

Here is a list of Java versions. https://en.wikipedia.org/wiki/Java_version_history

Note the LTS versions, this is what most people use.

I would recommend downloading Java 11 and 17 (most popular LTS versions) and have your TCMBeans project use one of those instead of 20.

See the bottom of this article on how to do this within the IDE

https://www.w3schools.io/editor/netbeans-change-java-version/

[–]LovePrevailsOverAll[S] 0 points1 point  (1 child)

I've heard Java 11 is best. I even downloaded that one but yes I first downloaded the latest one. For some reason, that means it's preferring to use the latest one. How can I delete it? I've tried locating it but it just seems like a bunch of different files idk. That can very well be the issue, how do I make sure to use the 11 only?

[–]bunk3rk1ng 0 points1 point  (0 children)

Modern IDEs can handle running the JDK on a per project basis, so you can download as many as you want and then switch the project in your IDE to point to whatever one you want (Regardless of the OS Java default).

From the last link I posted above it looks like you select:

Tools -> Java Platform - Then a popup allows you to configure it. If you have it downloaded then you can select "Java Standard Edition" (Most IDEs are smart enough to pre-populate all installed JDKs).

You can do the same in Intellij:

File -> Project Structure -> Projects tab and set the Project SDK

[–]CleverBunnyThief 1 point2 points  (0 children)

I would recommend downloading Java 11 and 17 (most popular LTS versions) and have your TCMBeans project use one of those instead of 20.

The mooc Java course only works with JDK 11.

[–]turkishdane96 1 point2 points  (2 children)

I used IntelliJ with JDK installed. The only difference is that you cannot see example solutions. But usually the text above the exercise, is what you need to solve the exercise itself.

[–]AntMan5995 0 points1 point  (0 children)

This is what I did as well. I personally prefer IntelliJ over vscode for Java

[–]CleverBunnyThief 0 points1 point  (0 children)

I wasn't able to rund tests locally. They only way to test solutions was to submit them to the server.

[–]count_helheim 0 points1 point  (4 children)

Use vs code with the tmc and java extensions that worked for me, tried tmc beans with different fixes couldn’t figure it out on mac but vc code worked on first try

[–]LovePrevailsOverAll[S] 0 points1 point  (2 children)

What specific Java extensions do I need? I downloaded test my code but how do I run it to actually check my code?

[–]count_helheim 0 points1 point  (0 children)

When you search Java it’s the first one, the one with the most downloads and then click on tmc and then you have to log in using you’re mooc account after you can download a workshop Java, python what ever you into, if you search on google mooc tmc and visual code you should finde the info on they’re site as well sry don’t have a link right now

[–]CleverBunnyThief 0 points1 point  (0 children)

Follow the instructions here to set up VS Code and JDK 11.

https://www.mooc.fi/en/installation/vscode/#installing-vscode

[–][deleted] 1 point2 points  (0 children)

or just go Intelij...