How to set up Java in Visual Studio Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ค. 2023
  • How to install Java with Visual Studio Code (vscode) in under 5 minutes.
    Install Visual Studio Code: code.visualstudio.com/
    Install Java Coding Pack: code.visualstudio.com/docs/ja...
    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 😄!

ความคิดเห็น • 133

  • @KennyYipCoding
    @KennyYipCoding  10 หลายเดือนก่อน +23

    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  10 หลายเดือนก่อน +2

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

    • @cemre6263
      @cemre6263 9 หลายเดือนก่อน

      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 9 หลายเดือนก่อน

      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 3 หลายเดือนก่อน +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 หลายเดือนก่อน

      Use code runner extension

  • @shades3692
    @shades3692 8 หลายเดือนก่อน +24

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

  • @DrBiography
    @DrBiography 9 หลายเดือนก่อน +10

    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 5 หลายเดือนก่อน +12

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

  • @karlatorres9649
    @karlatorres9649 2 หลายเดือนก่อน

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

  • @bunny11111
    @bunny11111 7 หลายเดือนก่อน +6

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

  • @user-ql4fy2gp6h
    @user-ql4fy2gp6h 8 หลายเดือนก่อน +4

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

  • @Uday_Aravind
    @Uday_Aravind 9 หลายเดือนก่อน +3

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

  • @laloquera5066
    @laloquera5066 7 หลายเดือนก่อน +2

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

  • @russel2506
    @russel2506 25 วันที่ผ่านมา

    Finally a 4k tutorial lol
    appreciate it

  • @bimaltwayana2058
    @bimaltwayana2058 5 หลายเดือนก่อน +1

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

  • @beyzaaaaaaaaaaaaaaaaa
    @beyzaaaaaaaaaaaaaaaaa 6 หลายเดือนก่อน +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.

  • @samcodebreakerkenya
    @samcodebreakerkenya 9 หลายเดือนก่อน +1

    Thanks alot for this. I appriciate this simple video

  • @SpideySpider
    @SpideySpider 4 หลายเดือนก่อน +3

    TIP FOR ANYONE WHO IS HAVING TROUBLE RUNNING THE SCRIPT (NOTHING HAPPENS WHEN YOU RUN IT)!!!
    If nothing appears in the terminal when you run it that means that you have to restart visual studio code AFTER you installed java
    took me a while to figure out but here it is!

    • @somename7104
      @somename7104 4 หลายเดือนก่อน

      hello how do i restart vscode? do i have to uninstall?

    • @SpideySpider
      @SpideySpider 4 หลายเดือนก่อน

      @@somename7104 no no no! just press the x button thats all!

  • @user-wp8mk3yg4o
    @user-wp8mk3yg4o 3 หลายเดือนก่อน

    thank you for the simple explanation

  • @joshh2497
    @joshh2497 8 หลายเดือนก่อน

    do i need to create a code in SRC folder ? or i can do in other file that it not connect in JavaProject?
    thank you for answer in advance!!

  • @beyzaaaaaaaaaaaaaaaaa
    @beyzaaaaaaaaaaaaaaaaa 7 หลายเดือนก่อน +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 )

  • @nabihachaiti6574
    @nabihachaiti6574 5 หลายเดือนก่อน +1

    That was so easy. Thanks a lot >

  • @mousumibanerjee733
    @mousumibanerjee733 8 หลายเดือนก่อน +1

    Thank you for the easy setup tutorial

  • @Nornfang
    @Nornfang 8 หลายเดือนก่อน +4

    As a man who hates eclipse, thank you

  • @tommy757591
    @tommy757591 5 หลายเดือนก่อน

    thank you this helped me get started

  • @AlgoJaz
    @AlgoJaz 9 หลายเดือนก่อน +7

    how do you get rid of the path line?

  • @Kzar101
    @Kzar101 หลายเดือนก่อน +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.

  • @MihNguyen238
    @MihNguyen238 หลายเดือนก่อน

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

  • @abdelmounaimsalouani9163
    @abdelmounaimsalouani9163 2 หลายเดือนก่อน

    thank you bro! you saved my day

  • @emperordrex5927
    @emperordrex5927 7 หลายเดือนก่อน +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

  • @m.m.m.4198
    @m.m.m.4198 4 หลายเดือนก่อน

    Thanks for your help!

  • @Mario-xk7kh
    @Mario-xk7kh 7 หลายเดือนก่อน

    My code doesn't run as a stand alone file as you did it but it did work in a project file.

  • @user-kr3go6dx6v
    @user-kr3go6dx6v 3 หลายเดือนก่อน

    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

  • @ShubhamKumar-dd7ll
    @ShubhamKumar-dd7ll 21 วันที่ผ่านมา

    thanks, clearly explained

  • @ahmedhassan5783
    @ahmedhassan5783 7 หลายเดือนก่อน

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

  • @DavidCourtney
    @DavidCourtney 7 หลายเดือนก่อน +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 5 หลายเดือนก่อน

      did you solve it I get the same message

    • @DavidCourtney
      @DavidCourtney 5 หลายเดือนก่อน

      @@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.

  • @RohitItgikar-lb5mz
    @RohitItgikar-lb5mz 9 หลายเดือนก่อน

    Thank you so much bro 🙏🙏🙏🙏

  • @khalilebdelli6199
    @khalilebdelli6199 8 หลายเดือนก่อน

    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

  • @zauliam
    @zauliam 23 วันที่ผ่านมา

    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.

  • @victors6917
    @victors6917 22 วันที่ผ่านมา

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

  • @pauldotto5130
    @pauldotto5130 14 วันที่ผ่านมา

    Thank you!

  • @snapesrds5766
    @snapesrds5766 9 หลายเดือนก่อน

    Thanks a lot Bro.

  • @bubule_
    @bubule_ 2 หลายเดือนก่อน

    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)

  • @lyrical_beats8609
    @lyrical_beats8609 6 หลายเดือนก่อน

    Thank you so much madam 🤗👏

  • @seanashleycastillo7095
    @seanashleycastillo7095 หลายเดือนก่อน

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

  • @Y-elloWorld
    @Y-elloWorld 3 หลายเดือนก่อน

    Thanks it works now, precise information, no dilly-dallying.

  • @MotivationHunt_manoj
    @MotivationHunt_manoj 7 หลายเดือนก่อน

    thanks sir its really worked

  • @meshomagdy1380
    @meshomagdy1380 หลายเดือนก่อน

    How did you create the starter code ?

  • @rajendra9812
    @rajendra9812 หลายเดือนก่อน +1

    Thank you sir

  • @barnevernet_in_norway7268
    @barnevernet_in_norway7268 9 วันที่ผ่านมา

    Thank you

  • @mdnishad2432
    @mdnishad2432 7 หลายเดือนก่อน

    Thanks a lot

  • @karensampouw
    @karensampouw 7 หลายเดือนก่อน

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

  • @Azero-hr4cr
    @Azero-hr4cr 8 หลายเดือนก่อน +1

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

  • @xplozion7603
    @xplozion7603 9 หลายเดือนก่อน +1

    ty! :)))))

  • @ielinDaisy
    @ielinDaisy หลายเดือนก่อน

    thanks man 💯

  • @studytimewithjency
    @studytimewithjency 2 หลายเดือนก่อน

    Smooth!! thanks

  • @shailendra4912
    @shailendra4912 8 หลายเดือนก่อน +1

    Thx

  • @nhp.1411
    @nhp.1411 10 หลายเดือนก่อน +2

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

    • @nhp.1411
      @nhp.1411 10 หลายเดือนก่อน

      help me

    • @KennyYipCoding
      @KennyYipCoding  10 หลายเดือนก่อน +2

      @@nhp.1411 check my pinned comment!

  • @doztech
    @doztech 4 หลายเดือนก่อน

    why output not working only terminal?

  • @navascrisis4626
    @navascrisis4626 7 หลายเดือนก่อน

    Thanks Bossman❤

  • @aaoooz
    @aaoooz 8 หลายเดือนก่อน

    thanks

  • @sivadarshini3165
    @sivadarshini3165 7 หลายเดือนก่อน

    Am not getting Run|debug
    in my program!

  • @b-yangalecio
    @b-yangalecio 4 หลายเดือนก่อน

    What if there's installed java already?

  • @cristofervillalobos2768
    @cristofervillalobos2768 3 หลายเดือนก่อน

    ty sir.

  • @cubesolver543
    @cubesolver543 13 วันที่ผ่านมา

    i am getting application error when i click on java pack

  • @abiabasd8120
    @abiabasd8120 หลายเดือนก่อน

    tnxs

  • @akhiln3722
    @akhiln3722 8 หลายเดือนก่อน

    how to set c in vs cod ???

  • @Shivali_
    @Shivali_ 4 หลายเดือนก่อน

    thank you so much for simplifying..

  • @nileshchoudhary4087
    @nileshchoudhary4087 9 หลายเดือนก่อน +2

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

    • @lemmeGoHome
      @lemmeGoHome 9 หลายเดือนก่อน +3

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

    •  2 หลายเดือนก่อน

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

  • @swarooptej7976
    @swarooptej7976 3 หลายเดือนก่อน

    thank u

  • @KadduMan
    @KadduMan 10 หลายเดือนก่อน +1

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

    • @avindrasookram3348
      @avindrasookram3348 10 หลายเดือนก่อน

      same no one has a solution for this

    • @avindrasookram3348
      @avindrasookram3348 10 หลายเดือนก่อน +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  10 หลายเดือนก่อน +1

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

  • @muhammadhabib9456
    @muhammadhabib9456 3 หลายเดือนก่อน

    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.

  • @rhonjaycedrickcastillon2530
    @rhonjaycedrickcastillon2530 2 หลายเดือนก่อน

    why does my vscode not working no matter what i do

  • @alvinkennethmayega1113
    @alvinkennethmayega1113 3 หลายเดือนก่อน

    Please help! At 2:36 When i try to run java --version it gives me an error instead. Help!!!

    • @bubule_
      @bubule_ 2 หลายเดือนก่อน

      same for me

    • @bubule_
      @bubule_ 2 หลายเดือนก่อน

      do u have find the solution ?

    • @alvinkennethmayega1113
      @alvinkennethmayega1113 2 หลายเดือนก่อน

      @@bubule_ I ended up reinstalling java

    • @bubule_
      @bubule_ 2 หลายเดือนก่อน

      @@alvinkennethmayega1113 ok thank's

  • @marklouiecaballero2307
    @marklouiecaballero2307 4 หลายเดือนก่อน

    What about the path?

  • @lavrin666
    @lavrin666 3 หลายเดือนก่อน +1

    good

  • @retarded.18
    @retarded.18 5 หลายเดือนก่อน

    the installer get stuck at last

  • @twoz9936
    @twoz9936 10 หลายเดือนก่อน

    why when i click ctrl+shift+p the java create project is not showing

    • @KennyYipCoding
      @KennyYipCoding  10 หลายเดือนก่อน

      You have to search for it, it won’t automatically show it unless you’ve used the command before

    • @twoz9936
      @twoz9936 10 หลายเดือนก่อน

      @@KennyYipCoding yes, i've been search it but its still not show up. Now i'm just try to install jdk 17 to replace my jdk 20 and hope the java project will show

    • @KennyYipCoding
      @KennyYipCoding  10 หลายเดือนก่อน

      Did you install the Java code pack for vscode?

    • @KennyYipCoding
      @KennyYipCoding  10 หลายเดือนก่อน +1

      There are also vscode extensions for Java included in the installation

    • @twoz9936
      @twoz9936 10 หลายเดือนก่อน +2

      @@KennyYipCoding finally bro, i found the problem that the pack doesn't automatic install the PROJECT MANAGER FOR JAVA. So the problem only on this thing. Thankyou so much bro

  • @duhanavc6773
    @duhanavc6773 5 หลายเดือนก่อน

    do we have to download jdk what it is for

    • @KennyYipCoding
      @KennyYipCoding  5 หลายเดือนก่อน

      It’s included in the kit in the video, you need it to compile and run java

  • @ajdndbdjbdj
    @ajdndbdjbdj 6 หลายเดือนก่อน

    God , i got a new lap top and they installed the purple version for it , im so mad i gotta download it again

    • @nathanwillett6918
      @nathanwillett6918 5 หลายเดือนก่อน

      can you have both version installed on your computer?

    • @ajdndbdjbdj
      @ajdndbdjbdj 5 หลายเดือนก่อน

      @@nathanwillett6918 idk i didn't even download it again, i just installed another one

  • @cemre6263
    @cemre6263 9 หลายเดือนก่อน +1

    when i write java --version to cmd it says
    Unrecognized option: --version
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    And it gives error in vsc:
    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:60
    + ... "c:\Users\cemre\Desktop\VisualStudio\Java\" ; if ($?) { javac deneme. ...
    + ~~~~~
    + CategoryInfo : ObjectNotFound: (javac:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    • @cemre6263
      @cemre6263 9 หลายเดือนก่อน

      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.

    • @KennyYipCoding
      @KennyYipCoding  9 หลายเดือนก่อน +1

      Thanks for sharing this!

  • @shankarraj3433
    @shankarraj3433 11 หลายเดือนก่อน

    👍

  • @mikijanicki2160
    @mikijanicki2160 5 หลายเดือนก่อน

    avast tells me that the coding pack is a virus, is it actually?

    • @KennyYipCoding
      @KennyYipCoding  5 หลายเดือนก่อน

      No, it comes directly from Microsoft

  • @ohio01
    @ohio01 3 หลายเดือนก่อน

    mine is dont work i followed the steps :\

  • @jeromemendoza495
    @jeromemendoza495 10 หลายเดือนก่อน +32

    why there's no run and debug button in mine

    • @luisduarte5097
      @luisduarte5097 9 หลายเดือนก่อน +2

      Part of an extension pack you have to download

    • @hakti7548
      @hakti7548 4 หลายเดือนก่อน

      Which one?

    • @spurthim4528
      @spurthim4528 3 หลายเดือนก่อน

      Or else it might have been hidden
      So click the 3 button on top right side u’ll find Run or debug

    • @meenapandey1473
      @meenapandey1473 หลายเดือนก่อน

      ​@@hakti7548Code runner

    • @ammapalliharshavardanreddy9795
      @ammapalliharshavardanreddy9795 26 วันที่ผ่านมา

      Install code runner extension!

  • @Blaze_Knowhow
    @Blaze_Knowhow 9 หลายเดือนก่อน

    Do i still need to download OpenJDK for this to work?

    • @KennyYipCoding
      @KennyYipCoding  9 หลายเดือนก่อน +1

      should be enough to just download the vscode java coding pack as it includes the JDK already.

    • @Blaze_Knowhow
      @Blaze_Knowhow 9 หลายเดือนก่อน

      @@KennyYipCoding okay thank you

  • @jessicagerlaban7125
    @jessicagerlaban7125 8 หลายเดือนก่อน

    3:02

  • @bimaltwayana2058
    @bimaltwayana2058 11 หลายเดือนก่อน

    😃

  • @iogilarb
    @iogilarb 2 หลายเดือนก่อน

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

  • @Rex_ults
    @Rex_ults 4 หลายเดือนก่อน

    bro you married asking for a friend?

  • @3a7anton
    @3a7anton 4 หลายเดือนก่อน

    Thank you bro @KennyYipCoding

  • @abirbiba3307
    @abirbiba3307 6 หลายเดือนก่อน

    Thank you

  • @itsam00n
    @itsam00n 2 หลายเดือนก่อน

    Thank you