nus-cs2030 / 2021-s1

27 stars 48 forks source link

Unable to run 'javac HelloWorld.java' #8

Open kamberbatch opened 4 years ago

kamberbatch commented 4 years ago

I followed the video and created a helloworld.java file on vim. When trying to compile it using javac, I encountered the issues as seen in the photo attached. Please help! image

yonggqiii commented 4 years ago

Hey @kamberbatch you're one step ahead! You need to install the JDK first. The instructions for installation are in the wiki.

Hope that helps!

kamberbatch commented 4 years ago

@yonggqiii I've installed it already, but it still doesnt work

yonggqiii commented 4 years ago

@kamberbatch what were the steps you took to install it?

kamberbatch commented 4 years ago

@yonggqiii I downloaded it from Oracle's website in the past and adjusted the environment variables too. It works on my Command Prompt but not on Ubuntu. I was also able to get my java version when typing it in command prompt when I typed 'javac -version'

yonggqiii commented 4 years ago

I see, you installed it in Windows, but not in WSL.

I reckon you can just run (in WSL) sudo apt update && sudo apt upgrade sudo apt install default-jdk

and you'd be good to go

kamberbatch commented 4 years ago

It didnt work for me though

image

yonggqiii commented 4 years ago

@kamberbatch could you run it line by line?

sudo apt-get update && sudo apt-get upgrade

then

sudo apt-get install default-jdk

see if that works!

kamberbatch commented 4 years ago

@yonggqiii Still didnt work for me

image

rohit0718 commented 4 years ago

the repository http://old-releases.ubuntu.com/ubuntu/ seems to be incompatible with ur ubuntu. did u add in a repository (ppa) urself by any chance?

kamberbatch commented 4 years ago

@rohit0718 not too sure about that but i dont think i did anything else other than those i typed/screenshotted above

yonggqiii commented 4 years ago

Might be your antivirus or firewall: https://social.technet.microsoft.com/Forums/en-US/e7119c11-0052-4fc9-bf8c-5963a427ef95/cannot-update-the-ubuntu-on-wsl?forum=win10itprogeneral

kamberbatch commented 4 years ago

Nvm issue solved! I realised I used Ubuntu from the Microsoft store not Ubuntu LTS. Works now!