The alternatives command, which manages default commands through symbolic links, can be used to select the default Java command. To print the programs that provide the java command that are managed by alternatives , use this command:. Simply enter the a selection number to choose which java executable should be used by default.
An easy way to append it to the file is to run this command:. Software Engineer DigitalOcean. Where would you like to share this to? Twitter Reddit Hacker News Facebook. Share link Tutorial share link. Sign Up. DigitalOcean home. Community Control Panel. Hacktoberfest Contribute to Open Source.
Prerequisites Before you begin this guide, you should have a regular, non-root user with sudo privileges configured on both of your servers—this is the user that you should log in to your servers as. Set Default Java If you installed multiple versions of Java, you may want to set one as your default i. Improve this answer. Pravin Bansal Pravin Bansal 2, 22 22 silver badges 14 14 bronze badges. Okt java Okt jre I added 'java I have java In your root folder add this to. Henni Henni 1 2 2 bronze badges.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Since you can have multiple versions of Java installed on your system, you can decide which one is the default one. To do so;. The image above shows that there are two alternatives to this system.
These choices are represented by numbers 1 Java 11 and 2 Java 8. To change the default version, type the associated number in this case, 1 or 2 and press Enter. In the output, you can find the path for each Java package installed on the system. Then, open the.
In this example, we use vim :. For example, if we copy the installation path for Java 11 in the previous step, the added line in the text editor will be:. In case you need to remove any of the Java packages installed, use the yum remove command. Confirm the process by pressing y yes , and it will uninstall the package from CentOS , as in the image below:. We also covered changing the default version and setting the home environment variable. You are now ready to get started with Java!
Introduction As a highly popular programming language, Java is used for developing anything from lightweight mobile to desktop applications.
0コメント