Open chloeoxe opened 2 years ago
Hello! You do not really require JDT in order to run the Java file on Vim, though it might be helpful in writing your code faster as compared to writing the code everything manually from scratch.
Your current file is in a correct and valid .java format. You can test if is working fine by writing the command on Terminal java HelloWorld.java
, which your current code will throw an error as there is no public static void main(String[])
function.
Your HelloWorld.java
file can include something like this:
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
And you should expect to see an output after running java HelloWorld.java
command on Terminal:
Hello World
I did include some syntax highlighting to identify the keywords easily. These are the steps as such:
vim ~/.vimrc
Type :syntax on
Open any .java
file and you should see something like this:
Hopefully this helps and clarifies your doubt! :)
Ohhh I see! Initially after watching the Luminus video, I thought that every time we started a java file, shortcuts would be immediately activated which would allow for faster coding like how the TA coded the 'public static void main(String [] args)' in an instant. However, yes I did try coding out the HelloWorld class manually, complied it, and it ran successfully! Now I know that actually Vim and Java does work properly for me and the shortcuts in the video are optional to allow for faster coding, thank you for the help as well as the syntax highlighting tip! It really helped.
Summary
JDT not activating despite creating a file called 'HelloWorld.java'
Description
I use mac and on my terminal, I managed to create a file using 'vim HelloWorld.java' as what is shown in the Luminus 'Intro to Java' video. However, in the video, right after creating the HelloWorld file, the JDT started loading and activating but this is not the case for me. Instead, the supposed 'Java' file acted more like a regular txt file (see image attached) and I'm assuming it's because my JDT does not activate automatically. Is anyone else a mac user and also experiencing such a problem? Does anyone know how to fix this? Any input would greatly help. Thank you!
Screenshots (if any):