An warware: shigar da java akan Linux

installing a kan Linux A cikin wannan labarin, za mu mai da hankali kan shigar da aikace-aikacen Java akan yanayin Linux. Za mu shiga cikin nitty-gritty na tsarin shigarwa, tattaunawa akan mahimman ษ—akunan karatu, ayyuka, da sauran abubuwa don sa aikace-aikacen Java ษ—inku ya yi aiki ba tare da matsala ba akan Linux.

** Sanya Java akan Linux ***

Kafin mu ci gaba da mafita, yana da mahimmanci a sami kyakkyawar fahimta game da Java da kuma dacewarta a cikin ci gaban duniya. Java, yaren shirye-shiryen da ke da alaฦ™a da abu, ana amfani da shi don ฦ™irฦ™irar aikace-aikacen da za su iya gudana akan dandamali da yawa, gami da Linux, macOS, da Windows. Ya shahara sosai saboda iyawar sa, sauฦ™in amfani, da ษ—imbin ษ—akunan karatu da APIs.

Ana shigar da Kit ษ—in Ci gaban Java (JDK)

Don fara shigar da Java akan Linux, yana da mahimmanci a fara shigar da Kit ษ—in Ci gaban Java (JDK). JDK ya zo tare da Java Runtime Environment (JRE), wanda ya zama dole don aiwatar da shirye-shiryen Java akan tsarin Linux ษ—in ku. Matakan da ke ฦ™asa dalla-dalla yadda ake cim ma wannan aikin:

  1. Sabunta jerin fakitin Linux ษ—inku ta hanyar gudanar da umarni mai zuwa a cikin tasha:
    sudo apt-get update
  2. Shigar da kunshin OpenJDK tare da umarni mai zuwa:
    sudo apt-get install openjdk-11-jdk
  3. Bayan nasarar shigar da kunshin OpenJDK, tabbatar da shigarwa ta hanyar aiwatar da umarnin:
    java -version

    Idan shigarwa ya yi nasara, ya kamata ku ga bayani game da sigar Java da aka shigar.

Saita Canjin Muhalli

Bayan shigar da JDK, yana da mahimmanci don saita masu canjin yanayi don haษ“aka amfani da tsarin yanayin ci gaban ku.

  • HANYA: Wannan madaidaicin ya ฦ™unshi jerin kundayen adireshi waษ—anda tsarin ke neman shirye-shirye masu aiwatarwa. ฦ˜ara JDK zuwa wannan jeri yana tabbatar da cewa an gane Java kuma ana samun dama daga kowane kundin adireshi akan tsarin Linux ษ—in ku.
  • Rariya Wannan madaidaicin yana wakiltar jagorar shigarwa na JDK. Sau da yawa wasu aikace-aikacen tushen Java suna amfani da shi don gano wurin shigarwar JDK.

Domin saita waษ—annan masu canjin yanayi, bi matakan da ke ฦ™asa:

1. Bude fayil ษ—in /etc/environment a cikin editan rubutu tare da gata na gudanarwa. Misali, zaku iya amfani da nano ta hanyar buga:

sudo nano /etc/environment

2. ฦ˜ara layin masu zuwa zuwa ฦ™arshen fayil ษ—in, maye gurbin "/ naku / java / hanya" tare da ainihin hanyar shigarwa na JDK:

JAVA_HOME="/your/java/path"
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

3. Ajiye fayil ษ—in kuma fita editan rubutu.

4. Sake loda masu canjin yanayi ta hanyar aiwatar da umarni:

source /etc/environment

Yanzu, kun yi nasarar shigar da sigar Java da ake buฦ™ata kuma kun daidaita masu canjin yanayi.

Fahimtar Laburaren Java da Ayyuka

Laburaren Java da ayyuka suna taka muhimmiyar rawa wajen sauฦ™aฦ™e tsarin ci gaba. Babban ษ—akin karatu da wadatar ayyuka yana ba masu haษ“akawa damar yin takamaiman ayyuka yadda ya kamata da inganci, ba tare da buฦ™atar rubuta lambar daga karce ba.

Binciko Standard Library na Java

Ma'auni na ษ—akin karatu na Java, wanda kuma aka sani da Java API (Application Programming Interface), ya ฦ™unshi yawancin azuzuwan da aka riga aka gina da kuma hanyoyin da ke da amfani ga ayyuka daban-daban na shirye-shirye. An tsara su cikin fakiti, waษ—anda ke taimakawa rarraba azuzuwan da ke da alaฦ™a da musaya zuwa sararin suna ษ—aya.

Wasu fakitin da aka saba amfani da su sun haษ—a da:

  • java.lang: Wannan fakitin yana ba da mahimman azuzuwan da musaya masu mahimmanci don yaren shirye-shiryen Java. Ya haษ—a da azuzuwan kamar Abu, String, Math, da System.
  • java.util: Wannan fakitin yana ba da tarin azuzuwan kayan aiki, gami da tsarin bayanai (ArrayList, HashMap, da sauransu), abubuwan amfani na kwanan wata da lokaci, da tsara lambar bazuwar.
  • java.io: Wannan fakitin ya ฦ™unshi azuzuwan da ake buฦ™ata don ayyukan shigarwa-fitarwa, kamar karantawa da rubutu zuwa fayiloli, na'ura wasan bidiyo, da sauran rafukan bayanai.
  • java.net: Wannan kunshin yana ba da azuzuwan don shirye-shiryen cibiyar sadarwa, kamar aiwatar da soket ษ—in TCP/IP da aiki tare da URLs.

A ฦ™arshe, ci gaban Java akan dandamali na Linux yana buฦ™atar cikakken sani game da tsarin shigarwa, daidaita yanayin canjin yanayi, da fahimtar ษ—akunan karatu da ayyuka na Java. Tare da JDK da ya dace da kuma saita sauye-sauyen yanayi yadda ya kamata, masu haษ“akawa na iya amfani da cikakken damar APIs na Java don ฦ™irฦ™irar aikace-aikace masu ฦ™arfi da inganci.

Shafi posts:

Leave a Comment