1

I am attempting to set up JAVA in Visual Studio Code and I can not get it working. I am getting an error that states "Linkage Error occurred while loading main class Hello". I have researched numerous sites and have not found any solutions that I understand. For example, I have seen several sites that state you must "enable-preview" on some setting but there are no directions on how to actually do that. I have installed the jdk-11.0.4 jdk version. I have never programmed in java so I do not know what is required. I reviewed several you tube videos and of course their installation went off without any problems! Is there anyone here that can help?

3
  • Problem is: without a real minimal reproducible example we have no idea what exactly you did, and therefore where your problem(s) originate from. I suggest: start with a good book or tutorial and the most basic hello world example. Don't use any sophisticated editor to compile / run your code. Instead, learn how to do that manually on the command line. And then, when you understand these basics, then move on and go with such tools. Commented Sep 27, 2019 at 2:38
  • While I appreciate the response I am somewhat confused as to what to do next. I am not sure there are any books on how to install JAVA in Visual Studio Code. From my research this seems to be a common error that individuals like myself are receiving when attempting to use JAVA in Visual Studio Code. As I stated I found several references to this error but not any clear directions on how to solve it. I am hoping that someone from this community can assist. Commented Sep 27, 2019 at 2:47
  • Just an FYI, Java is not an abbreviation for anything. It's just a word. No need to capitalize it all. Commented Oct 14, 2019 at 7:49

2 Answers 2

1

As per their documentation link, there are two ways to setup and run java with VS code

  1. They have created a special Installer of Visual Studio Code for Java developers. The package can be used as a clean install or an update for an existing development environment to add Java or Visual Studio Code.

    Installer of Visual Studio Code for Java developers

  2. Alternatively, you can also add Java language support to VS Code by installing the popular Java extensions by yourself.

Please see link below to setup and let me know if you face any issue in setting up and run java with VS Code.

Java in Visual Studio Code

There might be two reason to not identifying Java

  1. Might be java is not installed correctly
  2. Or there are multiple version installed so might be conflict
Sign up to request clarification or add additional context in comments.

8 Comments

Hi kj007, I used option 1 and tried to run the Hello.java program and encountered the following issues: Unrecognized option: --enable-preview, Error: Could not create the Java Virtual Machine, Error: A fatal exception has occurred. Program will exit.
is java is available on your environment from anywhere, I mean when you run "java -version" from command line, does it show correctly?
Hi kj007, from the command prompt javac -version returns 1.8.0_222
seems java is not installed correctly or you might have multiple version of java then clear from environment variable and set only one and check correct version shows when you run command from command line, I am big fan of IntelliJ and use VS Code for front end only but still face issue let me know I will installed myself and try..
yeah so there is conflict..you have multiple java version installed as you installed 11 too..so remove one..
|
0

Could you try F1 -> Java: Clean the Java language server workspace?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.