<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fahad Israr</title>
    <description>The latest articles on DEV Community by Fahad Israr (@fahadisrar).</description>
    <link>https://dev.to/fahadisrar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F243135%2F11b7ba9c-ed2a-4d11-b824-113b55303e15.jpeg</url>
      <title>DEV Community: Fahad Israr</title>
      <link>https://dev.to/fahadisrar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fahadisrar"/>
    <language>en</language>
    <item>
      <title>Guide to Install GraalVM Community Edition on Ubuntu</title>
      <dc:creator>Fahad Israr</dc:creator>
      <pubDate>Sun, 22 Mar 2020 14:47:58 +0000</pubDate>
      <link>https://dev.to/fahadisrar/guide-to-install-graalvm-community-edition-on-ubuntu-38h8</link>
      <guid>https://dev.to/fahadisrar/guide-to-install-graalvm-community-edition-on-ubuntu-38h8</guid>
      <description>&lt;p&gt;1) Download the &lt;a href="https://github.com/oracle/graal/releases"&gt;latest release of GraalVM&lt;/a&gt; and unpack it anywhere in your filesystem:&lt;/p&gt;

&lt;p&gt;Note: GraalVM Community Edition 19.3.0 and later releases can be found &lt;a href="https://github.com/graalvm/graalvm-ce-builds/releases"&gt;here&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ tar -xvzf graalvm-ce-java11-linux-amd64-20.0.0.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) Move the unpacked dir to &lt;code&gt;/usr/lib/jvm/&lt;/code&gt; and create a symbolic link to make your life easier when updating the GraalVM version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# mv graalvm-ce-java11-linux-amd64-20.0.0/ /usr/lib/jvm/
# cd /usr/lib/jvm
# ln -s graalvm-ce-java11-linux-amd64-20.0.0 graalvm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3) Add a new alternatives configuration. First grab the priorization number by listing the already installed JVMs and then use this number to configure the new one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# update-alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  *1           /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case I have 2 java alternatives installed, so I'm going to install the third.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm/bin/java 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Testing
&lt;/h2&gt;

&lt;p&gt;To make sure everything is working fine, set the new JVM on your environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo update-alternatives --config java

There are 3 programs which provide 'java'.

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
 *1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/graalvm-ce-java11-20.0.0/bin/java   4         manual mode

Enter to keep the current selection[+], or type selection number: 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify, just check the version number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you're set.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note
&lt;/h2&gt;

&lt;p&gt;The native-image executable is not bundled in the GraalVM distribution anymore. Install it manually using &lt;code&gt;$GRAALVM_HOME/bin/gu install native-image&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unable to use &lt;code&gt;gu&lt;/code&gt; command??
&lt;/h2&gt;

&lt;p&gt;Solution: Export path in &lt;code&gt;bashrc&lt;/code&gt; file &lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Open bashrc file: &lt;code&gt;sudo nano ~/.bashrc&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;At the end add this: &lt;code&gt;export PATH=$PATH:/usr/lib/jvm/graalvm-ce-java11-20.0.0/lib/installer/bin&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: You may use the suitable path as per your installation&lt;/p&gt;

&lt;h3&gt;
  
  
  After that you may try running &lt;code&gt;gu&lt;/code&gt; again: &lt;code&gt;gu install native-image&lt;/code&gt;
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Still Unable to use &lt;code&gt;native-image&lt;/code&gt;??
&lt;/h2&gt;

&lt;p&gt;Do the same for native-image:Add this to bashrc file for native-image&lt;/p&gt;

&lt;p&gt;&lt;code&gt;export PATH=$PATH:/usr/lib/jvm/graalvm-ce-java11-20.0.0/lib/svm/bin&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  To use the commands as Super User:
&lt;/h2&gt;

&lt;p&gt;Add this to &lt;code&gt;/root/.bashrc&lt;/code&gt; and &lt;code&gt;/root/.profile&lt;/code&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open bashrc for root &lt;code&gt;sudo nano /root/.bashrc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add these at the end :
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  export PATH=$PATH:/usr/lib/jvm/graalvm-ce-java11-20.0.0/lib/installer/bin
  export PATH=$PATH:/usr/lib/jvm/graalvm-ce-java11-20.0.0/lib/svm/bin

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Do the same for profile: &lt;code&gt;sudo nano /root/profile&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>graalvm</category>
      <category>quarkus</category>
      <category>linux</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
