Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How can I run a Java file in the terminal?

+1 vote
asked 2 days ago by codenxn (1,190 points)
Hi! I want to code a java script in the terminal, but I don't know how. I use the "VIM" IDE for programming, That's why I need to know how to run it in the terminal. And no, by saying "java script" I didn't meant the javascript programming language, I meant a script written in Java. Your help is appreciated!

1 Answer

0 votes
answered 1 day ago by Peter Minarik (66,630 points)

Let's call it a Java program or Java code to eliminate any confusion with the language JavaScript.

First, you'll need to compile your code. Then you can run it. If your code is in MyClass.java file, you'd do something like this:

javac MyClass.java
java MyClass

You will need to have a Java Development Kit installed for this.

You can read a bit more here: http://www.skylit.com/javamethods/faqs/javaindos.html.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...