Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is the command "java" the JVM?

Tags:

java

whenever they say run a .class file in JVM. do they mean with the command "java" in the terminal.

or can you click on it to open it?

like image 732
ajsie Avatar asked Jan 11 '10 20:01

ajsie


People also ask

What is java command in java?

The java command starts a Java application. It does this by starting the Java Virtual Machine (JVM), loading the specified class, and calling that class's main() method. The method must be declared public and static , it must not return any value, and it must accept a String array as a parameter.

What is JVM command line?

Use these options to configure your JVM. The options prefixed with -X are nonstandard. Options that relate to the JIT are listed under JIT and AOT command-line options. Options that relate to the Garbage Collector are listed under Garbage Collector command-line options.

Which command in java is used to invoke the JVM?

The JNI supports an Invocation API that allows you to load, initialize, and invoke the Java Virtual Machine. Indeed, the normal way of starting the Java interpreter, java , is no more than a simple C program that parses the command line arguments and invokes the Java Virtual Machine through the Invocation API.

How does java command work?

The java command starts a Java application. It does this by starting a Java runtime environment, loading a specified class, and calling that class's main method. By default, the first argument without an option is the name of the class to be called. A fully qualified class name should be used.


2 Answers

Yes, if you have the JRE installed, java should be the JVM.

like image 166
mdm Avatar answered Sep 19 '22 18:09

mdm


A java file is compiled into a class file, which is a bunch of java bytecode. The JVM is the thing that can execute java bytecode.

java is a command line tool that is part of a java runtime environment (JRE) that knows how to start a java virtual machine, load and execute your class file.

like image 23
Upgradingdave Avatar answered Sep 19 '22 18:09

Upgradingdave