subodh joshi
subodh joshi

Reputation: 365

Java Browser Plugin Or Manually installing Java

Here is my question i installed Java Plugin for Chrome it does mean i have installed java in my machine...And after installing this plugin can i run below command

java -jar myfile.jar

through a batch file or i have to install java in my machine and setup class-path then it should work?

If i will install Java browser plugin it automatically installed java in my machine and setup path as well.

Its hard for me t understand the situation how it works. Can anyone help me on this?

Upvotes: 5

Views: 803

Answers (2)

User123456
User123456

Reputation: 2738

Please first check your machine contains java (jdk or jre)

java -version -- if you get a valid output then you have java in your machine.

in order to run java -jar myfile.jar , you should install java (jre or jdk) in your machine and class path set to the relevant location. To run this you should install jdk or jre in your machine. Most program only need the JRE (Java Runtime Environment) but some programs need the Compiler at runtime in which case you need the JDK.

Please refer this link to find out How to set class path . Then you will be able to run your command.

Upvotes: 0

Aditya
Aditya

Reputation: 2934

The JRE is the Java Runtime Environment, i.e. the software you need to interpret and execute Java class files. The Java browser plugin is the bridge between the JRE and the browser, used to run Java classes of applets embedded in HTML.

You can check the Java plugin of Chrome browser in this link.

The plugin is bundled with the JRE, and runs inside a browser, allowing Java code to run inside the browser process on the client. The main entry point class must be written as an Applet when the plugin is used, but all the Java code it calls can be just regular Java.

There are limitations when running Java code with the Java plugin for security reasons. All code shall run within sandbox with limited access to the file system and such.

Also as the plugin check for installed JRE version at your machine, that means you do have JRE. You can install as many JDKs as you like. Just put them in different folders.

The one you refer to on the path is your choice - but presumably you'd choose the one that you want to use whenever you type "java ...." commands at the command line. In the absence of any other factors you should probably set this to be your most recent JDK version.

Note that your IDE may support multiple JDKs, for example Eclipse has "Preferences / Java / Installed JREs" where you can set up multiple JDKs/JREs for use with Eclipse

Upvotes: 1

Related Questions