How to set up Java in Visual Studio Code

Поділитися
Вставка
  • Опубліковано 30 вер 2024
  • How to install Java with Visual Studio Code (vscode) in under 5 minutes.
    Install Visual Studio Code: code.visualstu...
    Install Java Coding Pack: code.visualstu...
    Open vscode, and create new file. Name it whatever you want, but be sure to include the .java extension.
    Ex) Create a file named Test.java and add the following code. Make sure the file name is exactly the same as the class name.
    class Test {
    public static void main(String[] args) {
    System.out.println("HELLO WORLD JAVA");
    }
    }
    Simple click the run button and you should see the output "HELLO WORLD JAVA".
    You can also create a Java project by clicking Ctrl + Shift + P at the same time. Type in java create, and click on the Java: Create Java Project.
    And, there you have it! How to setup Java for Visual Studio Code in under 5 minutes.
    Java Game Programming Projects Playlist:
    • Java Game Programming ...
    JavaScript Game Programming Projects Playlist:
    • JavaScript Game Progra...
    Subscribe for more coding tutorials 😄!

КОМЕНТАРІ • 184

  • @KennyYipCoding
    @KennyYipCoding  Рік тому +38

    If you want to disable the parameter help box, in VSCode, on the bottom left there is a gear icon. Click on that, select settings. Search for "Java Inlay". Scroll down to where you see:
    *JavaScript › Inlay Hints › Parameter Names: Enabled*
    In the dropdown menu, select None. Scroll down a bit further and you'll see another:
    *Java › Inlay Hints › Parameter Names: Enabled*
    *Java › Inlay Hints › Parameter Names: Exclusions can be used to disable the inlay hints for methods.*
    Once again, in the dropdown menu, select None.
    Alternatively, you can open the settings.json file. To open this, press Ctrl+Shift+P at the same time, type in "settings.json" and select "Preference: Open User Settings (JSON)". Add this to the JSON file:
    "java.inlayHints.parameterNames.enabled": "none",

    • @KennyYipCoding
      @KennyYipCoding  Рік тому +2

      Like and Subscribe if you found this tutorial helpful :) ! Also, why not check out my tutorials playlist?
      Java Game Programming Projects Playlist:
      ua-cam.com/play/PLnKe36F30Y4Y1XQOqNsL9Fgg_p6nYhcng.html
      JavaScript Game Programming Projects Playlist:
      ua-cam.com/play/PLnKe36F30Y4bLhA-st9sC4ZthyV7nsL2Q.html

    • @cemre6263
      @cemre6263 Рік тому

      vsc gives me
      javac : The term 'javac' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
      spelling of the name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:76
      + ... Desktop\VisualStudio\Java\JavaProject\src\" ; if ($?) { javac App.jav ...
      + ~~~~~
      + CategoryInfo : ObjectNotFound: (javac:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
      PS C:\Users\cemre\Desktop\VisualStudio\Java\JavaProject\src> cd "c:\Users\cemre\Desktop\VisualStudio\Java\JavaProject\src\" ; if ($?) { javac App.java } ; if ($?) { java App }
      javac : The term 'javac' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
      spelling of the name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:76
      + ... Desktop\VisualStudio\Java\JavaProject\src\" ; if ($?) { javac App.jav ...
      + ~~~~~
      + CategoryInfo : ObjectNotFound: (javac:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
      Error pls help ig its about PATH idk how to fix it

    • @cemre6263
      @cemre6263 Рік тому

      I solved it. To solve this problem go cmd and type
      java -version
      javac -version
      The versions must be same ex: 17.0.8
      if they are different than press windowkey + R and type sysdm.cpl than go advanced than go envromental variables and check JAVA_HOME in user variables and PATH in system variables. Be sure that you checked the first variable in PATH
      if they are different for example JAVA_HOME shows 17.0.8 version and 8.1.0 in PATH (first/top variable) than you must delete 8.1.0 in PATH and you should put 17.0.8 version of javac to top of PATH with clicking edit. After all click ok buttons and restart cmd and vsc. It should work now.

    • @spurthim4528
      @spurthim4528 7 місяців тому +1

      I am not able to run the program….. I mean it’s not working is there any kind of extension to be installed??

    • @LoStFoReVeRiNtImE
      @LoStFoReVeRiNtImE 5 місяців тому

      Use code runner extension

  • @shades3692
    @shades3692 Рік тому +56

    At first, the terminal was unresponsive, but closing and opening VSC fixed my issue. Great video, man thx a lot!

    • @gringotico1759
      @gringotico1759 2 місяці тому

      Thanks for that. Was experiencing this issue.

  • @DrBiography
    @DrBiography Рік тому +18

    Thank you so much for providing this video, I recently have been struggling to figure out how to run java in visual studio code, this video helped me figure it out, I just liked and subscribed.

  • @bimaltwayana2058
    @bimaltwayana2058 10 місяців тому +17

    best tutorial ever. Best short and sweet and correctly taught how to install. Thank you so much sir.

  • @bunny11111
    @bunny11111 Рік тому +6

    this one better be helpful cuz I've been figuring how to run a java code on visual studio.

  • @AlgoJaz
    @AlgoJaz Рік тому +8

    how do you get rid of the path line?

  • @Nornfang
    @Nornfang Рік тому +5

    As a man who hates eclipse, thank you

  • @Нурлан-в8л
    @Нурлан-в8л Рік тому +6

    thank you, this video helped me a lot. I don't really know English, but you do useful things. Thanks❤

  • @DavidCourtney
    @DavidCourtney 11 місяців тому +4

    I'm just trying to run the Hello World example, but when I click on Run, I get "Homework1.java is a non-project file, only syntax errors are reported" in the Problems tab.

    • @duhanavc6773
      @duhanavc6773 9 місяців тому +1

      did you solve it I get the same message

    • @DavidCourtney
      @DavidCourtney 9 місяців тому

      @@duhanavc6773 In my case, the problem turned out to be that I had a bad setting in the settings.json file located at C:\Users\\AppData\Roaming\Code\User
      I deleted the settings.json file and everything started working. The reason my settings.json file was messing up Java was because I had been experimenting with Rust programming about a year prior, and my settings.json had some lines in there to get cargo working for Rust. And for whatever reason, those settings were conflicting with what Java was trying to do. Rather than figure out how to make the settings.json file work with Java while keeping my Rust settings, I opted to just delete the settings.json file ... and Java started working for me.
      Given that my particular situation probably doesn't match yours, I'm guessing what I did won't help you, but you can give it a try.

    • @diego-fc8ym
      @diego-fc8ym 4 дні тому

      its because of the "x:" i removed that and it finally worked

  • @williamkiarie9669
    @williamkiarie9669 Місяць тому +2

    I really appreciate your tutorials Kenny, I was able to successfully install the java code pack for vs code. 😉🙂🙂

  • @sivadarshini3165
    @sivadarshini3165 11 місяців тому +2

    Am not getting Run|debug
    in my program!

  • @nishamaniponnamdeniya5344
    @nishamaniponnamdeniya5344 2 місяці тому +2

    i can't download java

  • @kobysmith-mccallister4893
    @kobysmith-mccallister4893 3 місяці тому +4

    The GOAT of java tutorials

  • @belLuh20
    @belLuh20 3 місяці тому +1

    I just wanna ask, when I'm going to run the program, there will suddenly pop up of jdk compile project. What's that development kit?

  • @nhp.1411
    @nhp.1411 Рік тому +2

    I write
    "System.out.print("Hello World"); "
    it automatically changes to
    "System.out.print(s:"Hello World");"
    how to turn it off

  • @Kzar101
    @Kzar101 6 місяців тому +1

    if i try ro run the code is says 'javac' is not recognized as an internal or external command,
    operable program or batch file.

  • @Thaagift
    @Thaagift День тому

    Dude that's so cool that the subscribe border animates when u say subscribe how did u do that

  • @laloquera5066
    @laloquera5066 11 місяців тому +3

    Thank you very much for the great video! it has helped me a lot. Many, many thanks!

  • @Thaagift
    @Thaagift День тому

    Thank you so much bro concise and helpful!

  • @rajendra9812
    @rajendra9812 5 місяців тому +1

    Thank you sir

  • @nileshchoudhary4087
    @nileshchoudhary4087 Рік тому +2

    Idk after opening vs code ita sending me to redhat website ? I followed your steps

    • @lemmeGoHome
      @lemmeGoHome Рік тому +3

      same is happening with me. it's wanting me to install a JDK from there

    •  6 місяців тому

      Yeah, apparently we need to download a JDK separately for the Java programs to get compiled..

  • @emperordrex5927
    @emperordrex5927 11 місяців тому +1

    Please I need help I set up and installed it but it isn't showing on my cmd also I can't tag my java file in my html it just won't work

  • @commenter3844
    @commenter3844 Місяць тому

    Mine says "Build failed, do you want to continue? - Source: Debugger for Java" can anyone help me with this

    • @commenter3844
      @commenter3844 Місяць тому

      I just followed the code and my output says "x cannot be resolved to a variable"

  • @Uday_Aravind
    @Uday_Aravind Рік тому +3

    Thank you sir, I can run the codes now. Very helpful.

  • @beyzaaaaaaaaaaaaaaaaa
    @beyzaaaaaaaaaaaaaaaaa 11 місяців тому +1

    Thanks firstly i downloaded it like you did. But now im gonna download latest version from oracle. (Teacher request )So there will be two jdk on my laptop. İs that could cause any problem? and how can i use my latest jdk on vscode (after add path )

  • @beyzaaaaaaaaaaaaaaaaa
    @beyzaaaaaaaaaaaaaaaaa 11 місяців тому +1

    Hello, I want to ask something. Every time I open the vs code, a message saying "Java projects are opening, check the details" appears. It wasn't there before, is it normal? The laptop gets very hot while this is happening, that's why I asked.

  • @Azero-hr4cr
    @Azero-hr4cr Рік тому +1

    I did all the steps but still my code did not appear

  • @The_moonlit
    @The_moonlit Місяць тому

    If it doesnt work, keep running the program and clicking finish+launch vscode. After enough time it will work.

  • @PrathameshTusharPatil
    @PrathameshTusharPatil 3 місяці тому

    hello sir
    when i started to run my java program ,it is taking time and showing some issue so what could be the problem ??
    its always showing the following content :
    Initiating server activation
    Request to kill LSP server.
    Cannot kill: current process is None
    Launching Oracle Java SE Language Server with default system JDK and userdir

  • @TealComet
    @TealComet 19 днів тому

    Thanks for this tutorial.

  • @bimaltwayana2058
    @bimaltwayana2058 10 місяців тому +1

    already subscribed and liked and commented. more tutorials should be created like this.

  • @bubule_
    @bubule_ 7 місяців тому

    why i'm in the cmd in tape: java --version , my cumputeur said eror, and wen y want creat my new files he said : Sorry, something went wrong activating IntelliCode support for Java. Please check the "Language Support for Java" and "VS IntelliCode" output windows for details.
    and also: Please download and install a JDK to compile your project. You can configure your projects with different JDKs by the setting 'java.configuration.runtimes'
    what i need to made in this situation ?
    (sorry for my bad english)

  • @pradeep-mp3wz
    @pradeep-mp3wz 14 днів тому

    how to use the starter code ? 3:07

  • @TwitchBox_999
    @TwitchBox_999 8 місяців тому +1

    good

  • @MihNguyen238
    @MihNguyen238 5 місяців тому

    Wow, thanks! Somehow Eclipse doesn't work but VSC works perfectly!

  • @xplozion15500
    @xplozion15500 Рік тому +1

    ty! :)))))

  • @johnla4098
    @johnla4098 27 днів тому

    thanks for this tutorial

  • @karlatorres9649
    @karlatorres9649 6 місяців тому +1

    Thank you for making this video! I was stuck for a bit but you're very clear in your explanation! Thanks again!

  • @tayyabaamanat9968
    @tayyabaamanat9968 4 місяці тому

    hey java is not downloading it shows notification internet problem whereas internet is working greatly

  • @zauliam
    @zauliam 5 місяців тому

    I follow every steps, but when I type java --version in cmd, it keep giving me the message 'java' is not recognized as an internal or external command, operable program or batch file. Please help me figure out how to solve it.

  • @RIPIzzy022404
    @RIPIzzy022404 Місяць тому

    it still doesn't show java being instsalled on my computer, i've installed this like six times.

  • @seanashleycastillo7095
    @seanashleycastillo7095 6 місяців тому

    I don't know why but I can't download the extension for the VScode right from the start

  • @nursultanyrysbaev9178
    @nursultanyrysbaev9178 7 днів тому

    thank you!

  • @growthbytes-eu6tu
    @growthbytes-eu6tu Місяць тому

    thanks a lot man !

  • @DalandanReal
    @DalandanReal 11 днів тому

    Perfection

  • @shailendra4912
    @shailendra4912 Рік тому +1

    Thx

  • @andreasteguhsantosokosasih3816
    @andreasteguhsantosokosasih3816 Місяць тому

    thanks bro

  • @Hindu_rastr_
    @Hindu_rastr_ Місяць тому

    thanks bruh

  • @scaramanzia
    @scaramanzia Місяць тому

    thanks man :)

  • @thronex5808
    @thronex5808 25 днів тому

    Thanks!

  • @justcurious1940
    @justcurious1940 20 днів тому

    Cool.

  • @chandani521
    @chandani521 2 місяці тому

    thank you

  • @jl1d_5
    @jl1d_5 Місяць тому

    Direct, and easy to understand, very demure, very classic, very excellent!

  • @AyushSinhx
    @AyushSinhx Місяць тому

    thanks

  • @rajtilak4358
    @rajtilak4358 2 місяці тому

    thanks

  • @AnubhavPatra-f4f
    @AnubhavPatra-f4f 7 місяців тому

    can you post a video of settings of java to allow pakages in java to work as like if first line is package package1 is therethen my code does not work eventhough everything is correct

  • @moviehollywood2325
    @moviehollywood2325 Місяць тому

    You do great job sir you easily tell how this thing is going to be done on windows thanks for your guidance ☺️

  • @yourabadviserofbusiness
    @yourabadviserofbusiness 2 місяці тому

    nice video very helpful. you need to make more video like this.

  • @muhammadhabib9456
    @muhammadhabib9456 8 місяців тому

    bro i got a build failed error, like i am starting to get stressed out not getting this shit fixed as i want to learn java.

  • @doztech
    @doztech 8 місяців тому

    why output not working only terminal?

  • @khalilebdelli6199
    @khalilebdelli6199 Рік тому

    java -version
    The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe.
    i get this error when i run the java -version in my pc

  • @cubesolver543
    @cubesolver543 4 місяці тому

    i am getting application error when i click on java pack

  • @Fiery_drivers
    @Fiery_drivers 3 місяці тому

    helpfull video thanks mate !

  • @PappuManasa-qq6ub
    @PappuManasa-qq6ub 3 місяці тому

    you heped me alot...thankyou soo much💗

  • @AdachiYuu
    @AdachiYuu Місяць тому

    thank you so much it's a easy process than other one i download it 2 year ago .

  • @victors6917
    @victors6917 5 місяців тому

    do i have to install java on the same directory as vsCode?

  • @Chanmeow-rl1eh
    @Chanmeow-rl1eh 2 місяці тому

    easy to understand. Thank you so much.

  • @Hero-ut7vx
    @Hero-ut7vx Місяць тому

    Thank you very clear and concise!

  • @ielinDaisy
    @ielinDaisy 5 місяців тому

    thanks man 💯

  • @dennyjames9100
    @dennyjames9100 Місяць тому

    Whats your main class? Im getting the error "Error: Main method not found in the file, please define the main method as: public static void main(String[] args)" when I type in the same code as you

  • @rhonjaycedrickcastillon2530
    @rhonjaycedrickcastillon2530 7 місяців тому

    why does my vscode not working no matter what i do

  • @ShubhamKumar-dd7ll
    @ShubhamKumar-dd7ll 5 місяців тому

    thanks, clearly explained

  • @rollinginthedeep6900
    @rollinginthedeep6900 29 днів тому

    Based and intelligent and clear

  • @b-yangalecio
    @b-yangalecio 8 місяців тому

    What if there's installed java already?

  • @ohio01
    @ohio01 7 місяців тому

    mine is dont work i followed the steps :\

  • @studytimewithjency
    @studytimewithjency 6 місяців тому

    Smooth!! thanks

  • @dashst29
    @dashst29 Місяць тому

    Thanks, this really helps me a lot

  • @itsam00n
    @itsam00n 7 місяців тому

    Thank you

  • @ahmedhassan5783
    @ahmedhassan5783 11 місяців тому

    is it free unlike the C# development kit extension which requires subscribtion?

  • @Rex_ults
    @Rex_ults 8 місяців тому

    bro you married asking for a friend?

  • @Ali-EditsGS
    @Ali-EditsGS 3 місяці тому

    thanks bro
    i appriciate it

  • @meshomagdy1380
    @meshomagdy1380 5 місяців тому

    How did you create the starter code ?

  • @iogilarb
    @iogilarb 6 місяців тому

    i hate java, but i love it, why? 😢

  • @KadduMan
    @KadduMan Рік тому +1

    why is that x: coming just before string sir, i am also facing the same issue

    • @avindrasookram3348
      @avindrasookram3348 Рік тому

      same no one has a solution for this

    • @avindrasookram3348
      @avindrasookram3348 Рік тому +1

      I found the answer :
      If you do not want to have them in your editor, you can set the setting java.inlayHints.parameterNames.enabled to none

    • @KennyYipCoding
      @KennyYipCoding  Рік тому +1

      Thanks for bringing this up! I posted the solution as a pinned comment

  • @nabihachaiti6574
    @nabihachaiti6574 9 місяців тому +1

    That was so easy. Thanks a lot >

  • @AutobotsTransform
    @AutobotsTransform Місяць тому

    Excellent 👍

  • @simplsurvival
    @simplsurvival 9 місяців тому

    the installer get stuck at last

  • @karensampouw
    @karensampouw 11 місяців тому

    i already tried to download the java pack but it says failed

  • @zavqiddintojiboev5805
    @zavqiddintojiboev5805 3 місяці тому

    great job!

  • @againstjebelallawz
    @againstjebelallawz 2 місяці тому

    Good job Mr. Yip! Great guide!

  • @barnevernet_in_norway7268
    @barnevernet_in_norway7268 4 місяці тому

    Thank you

  • @saiteja7985
    @saiteja7985 4 місяці тому

    TQ sir😊😊

  • @pauldotto5130
    @pauldotto5130 4 місяці тому

    Thank you!

  • @Diyanshi__Creations
    @Diyanshi__Creations 10 місяців тому

    Thank you so much madam 🤗👏

  • @alanslc3891
    @alanslc3891 Місяць тому

    Like your style, no bs, straight to the point.

  • @m.m.m.4198
    @m.m.m.4198 8 місяців тому

    Thanks for your help!

  • @abdelmounaimsalouani9163
    @abdelmounaimsalouani9163 6 місяців тому

    thank you bro! you saved my day

  • @abiabasd8120
    @abiabasd8120 6 місяців тому

    tnxs

  • @swarooptej7976
    @swarooptej7976 8 місяців тому

    thank u

  • @marklouiecaballero2307
    @marklouiecaballero2307 8 місяців тому

    What about the path?