How to set up Java in Visual Studio Code

Поделиться
HTML-код
  • Опубликовано: 29 сен 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 😄!

Комментарии • 182

  • @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:
      ruclips.net/p/PLnKe36F30Y4Y1XQOqNsL9Fgg_p6nYhcng
      JavaScript Game Programming Projects Playlist:
      ruclips.net/p/PLnKe36F30Y4bLhA-st9sC4ZthyV7nsL2Q

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

  • @williamkiarie9669
    @williamkiarie9669 Месяц назад +2

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

  • @alanslc3891
    @alanslc3891 Месяц назад

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

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

  • @Nornfang
    @Nornfang Год назад +5

    As a man who hates eclipse, thank you

  • @againstjebelallawz
    @againstjebelallawz 2 месяца назад

    Good job Mr. Yip! Great guide!

  • @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?

  • @Y-elloWorld
    @Y-elloWorld 7 месяцев назад

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

  • @Fiery_drivers
    @Fiery_drivers 3 месяца назад

    helpfull video thanks mate !

  • @nursultanyrysbaev9178
    @nursultanyrysbaev9178 5 дней назад

    thank you!

  • @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 )

  • @nishamaniponnamdeniya5344
    @nishamaniponnamdeniya5344 2 месяца назад +2

    i can't download java

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

  • @Shivali_
    @Shivali_ 8 месяцев назад

    thank you so much for simplifying..

  • @joshh2497
    @joshh2497 Год назад

    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!!

  • @rhonjaycedrickcastillon2530
    @rhonjaycedrickcastillon2530 7 месяцев назад

    why does my vscode not working no matter what i do

  • @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"

  • @abiabasd8120
    @abiabasd8120 6 месяцев назад

    tnxs

  • @jessicagerlaban7125
    @jessicagerlaban7125 Год назад

    3:02

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

  • @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 3 дня назад

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

  • @Нурлан-в8л
    @Нурлан-в8л Год назад +6

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

  • @AlgoJaz
    @AlgoJaz Год назад +8

    how do you get rid of the path line?

  • @sivadarshini3165
    @sivadarshini3165 11 месяцев назад +2

    Am not getting Run|debug
    in my program!

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

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

  • @kobysmith-mccallister4893
    @kobysmith-mccallister4893 3 месяца назад +4

    The GOAT of java tutorials

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

  • @laloquera5066
    @laloquera5066 11 месяцев назад +3

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

  • @The_moonlit
    @The_moonlit 29 дней назад

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

  • @rajendra9812
    @rajendra9812 5 месяцев назад +1

    Thank you sir

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

  • @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)

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

  • @TealComet
    @TealComet 17 дней назад

    Thanks for this tutorial.

  • @pradeep-mp3wz
    @pradeep-mp3wz 13 дней назад

    how to use the starter code ? 3:07

  • @Azero-hr4cr
    @Azero-hr4cr Год назад +1

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

  • @RIPIzzy022404
    @RIPIzzy022404 Месяц назад

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

  • @Uday_Aravind
    @Uday_Aravind Год назад +3

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

  • @johnla4098
    @johnla4098 26 дней назад

    thanks for this tutorial

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

  • @tayyabaamanat9968
    @tayyabaamanat9968 4 месяца назад

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

  • @bimaltwayana2058
    @bimaltwayana2058 10 месяцев назад +1

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

  • @MihNguyen238
    @MihNguyen238 5 месяцев назад

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

  • @moviehollywood2325
    @moviehollywood2325 Месяц назад

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

  • @seanashleycastillo7095
    @seanashleycastillo7095 6 месяцев назад

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

  • @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!

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

  • @DalandanReal
    @DalandanReal 10 дней назад

    Perfection

  • @growthbytes-eu6tu
    @growthbytes-eu6tu Месяц назад

    thanks a lot man !

  • @scaramanzia
    @scaramanzia Месяц назад

    thanks man :)

  • @jl1d_5
    @jl1d_5 Месяц назад

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

  • @AdachiYuu
    @AdachiYuu Месяц назад

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

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

  • @andreasteguhsantosokosasih3816
    @andreasteguhsantosokosasih3816 Месяц назад

    thanks bro

  • @Hindu_rastr_
    @Hindu_rastr_ Месяц назад

    thanks bruh

  • @justcurious1940
    @justcurious1940 19 дней назад

    Cool.

  • @thronex5808
    @thronex5808 23 дня назад

    Thanks!

  • @chandani521
    @chandani521 2 месяца назад

    thank you

  • @yourabadviserofbusiness
    @yourabadviserofbusiness 2 месяца назад

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

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

  • @AyushSinhx
    @AyushSinhx Месяц назад

    thanks

  • @rajtilak4358
    @rajtilak4358 2 месяца назад

    thanks

  • @TwitchBox_999
    @TwitchBox_999 8 месяцев назад +1

    good

  • @victors6917
    @victors6917 4 месяца назад

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

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

  • @xplozion15500
    @xplozion15500 Год назад +1

    ty! :)))))

  • @ahmedhassan5783
    @ahmedhassan5783 11 месяцев назад

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

  • @cubesolver543
    @cubesolver543 4 месяца назад

    i am getting application error when i click on java pack

  • @shailendra4912
    @shailendra4912 Год назад +1

    Thx

  • @PappuManasa-qq6ub
    @PappuManasa-qq6ub 3 месяца назад

    you heped me alot...thankyou soo much💗

  • @doztech
    @doztech 8 месяцев назад

    why output not working only terminal?

  • @Chanmeow-rl1eh
    @Chanmeow-rl1eh 2 месяца назад

    easy to understand. Thank you so much.

  • @Hero-ut7vx
    @Hero-ut7vx Месяц назад

    Thank you very clear and concise!

  • @ohio01
    @ohio01 7 месяцев назад

    mine is dont work i followed the steps :\

  • @karensampouw
    @karensampouw 11 месяцев назад

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

  • @dashst29
    @dashst29 Месяц назад

    Thanks, this really helps me a lot

  • @b-yangalecio
    @b-yangalecio 8 месяцев назад

    What if there's installed java already?

  • @Mario-xk7kh
    @Mario-xk7kh 11 месяцев назад

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

  • @rollinginthedeep6900
    @rollinginthedeep6900 28 дней назад

    Based and intelligent and clear

  • @Rex_ults
    @Rex_ults 8 месяцев назад

    bro you married asking for a friend?

  • @ielinDaisy
    @ielinDaisy 5 месяцев назад

    thanks man 💯

  • @iogilarb
    @iogilarb 6 месяцев назад

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

  • @meshomagdy1380
    @meshomagdy1380 5 месяцев назад

    How did you create the starter code ?

  • @ShubhamKumar-dd7ll
    @ShubhamKumar-dd7ll 4 месяца назад

    thanks, clearly explained

  • @nabihachaiti6574
    @nabihachaiti6574 9 месяцев назад +1

    That was so easy. Thanks a lot >

  • @Ali-EditsGS
    @Ali-EditsGS 3 месяца назад

    thanks bro
    i appriciate it

  • @Diyanshi__Creations
    @Diyanshi__Creations 10 месяцев назад

    Thank you so much madam 🤗👏

  • @ajdndbdjbdj
    @ajdndbdjbdj 11 месяцев назад

    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 9 месяцев назад

      can you have both version installed on your computer?

    • @ajdndbdjbdj
      @ajdndbdjbdj 9 месяцев назад

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

  • @mikijanicki2160
    @mikijanicki2160 9 месяцев назад

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

    • @KennyYipCoding
      @KennyYipCoding  9 месяцев назад

      No, it comes directly from Microsoft

  • @simplsurvival
    @simplsurvival 9 месяцев назад

    the installer get stuck at last

  • @abdelmounaimsalouani9163
    @abdelmounaimsalouani9163 6 месяцев назад

    thank you bro! you saved my day

  • @studytimewithjency
    @studytimewithjency 6 месяцев назад

    Smooth!! thanks

  • @AutobotsTransform
    @AutobotsTransform Месяц назад

    Excellent 👍

  • @itsam00n
    @itsam00n 7 месяцев назад

    Thank you

  • @m.m.m.4198
    @m.m.m.4198 8 месяцев назад

    Thanks for your help!

  • @zavqiddintojiboev5805
    @zavqiddintojiboev5805 3 месяца назад

    great job!