S
S
sdgdsgdgs892019-01-08 01:15:21
linux
sdgdsgdgs89, 2019-01-08 01:15:21

How to make a JAVA call in Linux shorter?

I downloaded JDK 11 to a Linux server, and now to run the program I write:
/usr/local/JDK/bin/javac ./Programm.java
/usr/local/JDK/bin/java Programm
How to make it possible to write without /usr/local/JDK/bin/, that is, just javac and java ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MechanicZelenyy, 2019-01-08
@MechanicZelenyy

Use the utility update-java-alternativesto set your Java as default.
Set java version as default (needs root permissions):
askubuntu

J
jcmvbkbc, 2019-01-08
@jcmvbkbc

How to make it possible to write without /usr/local/JDK/bin/, that is, just javac and java?

By adding /usr/local/JDK/bin to PATH in some .bash_profile:
PATH="/usr/local/JDK/bin:$PATH"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question