Questions tagged as ['java']

Java is a programming language originally developed by Sun Microsystems. Questions here should be about the installation, configuration and troubleshooting a JVM (Java Virtual Machine) or a JRE (Java Runtime Environment). Programming questions (unless directly related to Ubuntu) should be asked on StackOverflow.com.
Score: 0
rajin100000 avatar
How to write a shell script that will reload terminal at middle of the script and then start using commands again?
pk flag

I recently knew about sdkman in gitpod.io and I wanna install different java versions using this manager. But I have a very old version of sdkman. That's I need to update it, then install java. But I don't wanna type this commands in my every repository in gitpod. That's why I have written an shell script prerequisites.sh and I will use this file in every repository. The script is:-

sdk update
sdk ...
Score: 0
Julius Kriele avatar
I tried to install minecraft on my chromebook via linux and it says: package architecture (amd64) does not match system (arm64) how can i fix that?
tf flag

I tried to install minecraft on my chromebook via linux and it says: package architecture (amd64) does not match system (arm64) how can i fix that ?

Score: 0
Installed Oracle JRE 8, but don't see it installed & can't select it
cn flag

Running UbuntuStudio v20.04

Trying to get Oracle Java selected instead of OpenJDK in order for my Trading Platform to work - using a JNLP file. It must use the Oracle version. Have installed latest from Oracle from here.

It installed to dir/usr/lib/jvm/jre1.8.0_301 but this is what it shows using this command.

MS-7640:~$ update-java-alternatives -l

java-1.11.0-openjdk-amd64      1111       /usr/lib/j ...
Score: 1
danielgolive avatar
Run java -jar from bash file
my flag

This is my .sh file and I'm trying to run it from a terminal, but it doesn't work even after checking paths, installing libc6-i386 and simplify it to a direct java call. Until here java path was not recognized. Does someone know how to do it?

#!/bin/bash
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
CLASSPATH=/home/daniel/test/commons-lang3-3.5.jar;/home/daniel/test/test-1.0.0.jar:.
$JAVA_HOME/bi ...
Score: 0
UserS avatar
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Container
ae flag

I am pretty new to Ubuntu and also new to this forum. Looking for some help.

I've been trying to install Impro-Visor by downloading the Impro-Visor_unix_10_2.sh file and running that in a terminal.

I then get the following error message:

Starting Installer ...
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Container
    at com.install4j.runtime.installer.frontend.headless.AbstractHea ...
Score: 0
CLI: How to browse contents in a jar file?
mx flag

Inside a Ubuntu OS, how can I browse contents in a jar file by terminal?

Score: 0
pnkj avatar
Java taking too much memory in Ubuntu 20.04 after using Android Studio
cn flag

My desktop is too laggy (although I closed Android studio) to move, so I used top to see the reason.

RAM is 12G, and the desktop environment is gnome

this is the result of top

PID USER PR VIRT RES SHR %CPU %MEM TIME+ COMMAND
4172 pnkj 20 0 7181972 3.9g 4152 S 0.0 33.6 47:16.43 java

this is the result of jstack 4172

Threads class SMR info:
_java_thread_list=0x00007f8d0c0ca9a0, length=27, elem ...
Score: 0
pcbillions53 avatar
Set JAVA_HOME in Ubuntu without "install" the JDK
ec flag

I've just downloaded and extracted the JDK archive, next moving it to my /opt directory. Inside IntelliJ, everything is working properly. I just point the path to the JDK in the settings. But I cannot issue java -version command... It says that I need to "install" Java... The question is: how can I set JAVA_HOME environment variable in Ubuntu, without actually "install" the JDK? Thanks!

Score: 0
VALOS avatar
Minecraft server not loading server.properties when it's loaded as a service
cn flag

I've followed many tutorials, but for some reason the service for my minecraft server won't read the server.properties file. I have a basic understanding of Ubuntu (had to learn how to use it for personal projects and college).

However, when I start it normally through the command line with the following command java -Xms4G -Xmx12G -jar serverstarter-2.0.1.jar nogui it does read the server properties fi ...

Score: 1
why were openjdk 14 and 13 removed from the repos
cn flag

Today, my CI/CD pipelines died because we maintain several applicatiins which depend on Java 14. Looking at the logs, I saw that their dependencies could not be fulfilled, since they depend on java 14.

Indeed, it seems to have recently been removed from the (focal) repos. The only thing I can find is:

https://bugs.launchpad.net/ubuntu/+source/openjdk-14/+bug/1934892

I would love to know why it has be ...

Score: 0
Tamil Selvan avatar
How do I run mutiple Java applications with different versions?
in flag

I am using Ubuntu 18.04 LTS and I have 2 apps which need to run with different Java versions. My 1st app (Mirth Connect) needs to run on jre1.8.0_171 and my second app (Power Assist) needs to run on java-11-openjdk-amd64.

$ sudo update-alternatives --config java

There are 3 choices for the alternative java (providing /usr/bin/java).
  
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java   
1 /usr/lib/jv ...
Score: 0
srn122 avatar
oracle db driver for php connection - ubuntu 20.04
bd flag

So I asked this question a few days ago but the topic was closed because I was running on ubuntu 16.04. Now I have updated to Ubuntu 20.04.3 LTS.

I have a php page on apache, and my oracble db connection:

$conn=odbc_connect("hostname","user","password");

gives me this error:

AH01071: Got error 'PHP message: PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, ...

Score: 0
Qureshi avatar
failed reallocation of scalar replaced objects
cn flag

I have a file consisting of 26618 rules and when I execute it with Alpha it gave me a memory exception:

“Exception in thread "main" java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects”

I also try increasing the heap size and use java -Xmx16g -jar alpha.jar -i rules.lp then I get the following exception:

“Exception in thread "main" java.lang.OutOfMemoryEr ...

Score: 0
kujaw avatar
How to start Tomcat 9 on Ubuntu 18.04 as a service in debug mode?
ru flag

(looks like my question is evolving, after solving it I will edit it appropriately)

As in the title. I can run Tomcat as a service, but I have no idea how to run it in debug mode.

I've tried to run it in debug mode from terminal as in this question: https://stackoverflow.com/questions/16689274/how-to-start-debug-mode-from-command-prompt-for-apache-tomcat-server

For unix first export variables:

e ...

Score: 0
DoomRider avatar
Illegal instruction (core dumped) error while building Android 11
cn flag

For a quiet some time I'm trying to build Android 11 for Sony Xperia XZ2 H8266. Everytime process comes to build org.apache.http.legacy package it gets an error.

[ 99% 263/264] //external/apache-http:org.apache.http.legacy dexpreopt [common]
FAILED: out/soong/.intermediates/external/apache-http/org.apache.http.legacy/and
roid_common/dexpreopt/profile.prof
ANDROID_LOG_TAGS="*:e" out/soong/host/linux ...
Score: 1
dms489 avatar
Netbeans 12.4 C/C++
de flag

I need to build C/C++ projects on Netbeans 12.4 with Ubuntu 18.04. There have been a long list of failures - trying earlier versions of Netbeans and even Eclipse. I can't find a simple tutorial / example for using the Lightweight C/C++.

Here is what I have done so far:

  1. Install Netbeans 12.4 with sudo apt install netbeans. This loaded java 11 jdk.

  2. Wrote and tested the usual Java Hello World.

  3. In ...

Score: 0
Brqdford avatar
Unable to create native thread, Pterodactyl Panel, Minecraft servers
in flag

Linux panel 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x 86_64 x86_64 GNU/Linux

So I run minecraft servers using the pterodactyl panel on a ubuntu linux server. server has 8 cores 16 threads. I use aikars flags for my j ...

Score: 1
user3464390 avatar
how to build a snap based on a jre
fr flag

I'm the developer of jape, a formal logic proof editor which uses java to provide a GUI and OCaml to provide a proof-step engine. (see rbornat/jape on github). I'm trying to package jape as a snap. The snap contains a jre, built using jlink and the JDK 11 from adoptopenjdk. It commences by calling a class in the jre.

To build the snap I had already to include build-attributes: [keep-execstack] because t ...

Score: 0
MMAN avatar
use a different Java version when executing .sh script in linux
au flag

We have Java 7 installed in our linux server but for a specific shell script, want to use a different version and execute. Below is the code I have in shell script, when I execute the shell script, it is not using the new java path set in the file. how can I set the java home for running this script?

#!/bin/bash            
export JAVA_HOME=/data/....          
export PATH=$JAVA_HOME/bin:$PATH      ...
Score: 1
Keval Shah avatar
Getting installation probllem in installing Discord
nu flag
unable to install discord:
    Error while installing package: installed oracle-java11-installer-local package 
    post-installation script subprocess returned error exit ststus 1

I have downloaded .deb file from internet and got the error.not only discord I got same problem while installing some softwares.

so thanks in advance.

Keval

Score: 1
alex avatar
Java 11 installation complains about dependencies
in flag

I have installed Java 11 from this site - https://bell-sw.com/pages/repositories/#apt by using the following commands:

wget -q -O - https://download.bell-sw.com/pki/GPG-KEY-bellsoft | sudo apt-key add -
echo "deb [arch=amd64] https://apt.bell-sw.com/ stable main" | sudo tee /etc/apt/sources.list.d/bellsoft.list
sudo apt-get update
sudo apt-get install bellsoft-java11

Currently I get:

"Следующие ...

Score: 0
Nicholas Saunders avatar
How to deploy a WAR file to jetty without using sudo?
mx flag

deploying this specific war file to jetty is somewhat awkward:

nicholas@mordor:~/NetBeansProjects/x$ 
nicholas@mordor:~/NetBeansProjects/x$ sudo cp build/libs/x.war /var/lib/jetty9/webapps/ -v
'build/libs/x.war' -> '/var/lib/jetty9/webapps/x.war'
nicholas@mordor:~/NetBeansProjects/x$ 
nicholas@mordor:~/NetBeansProjects/x$ lynx localhost:8081/x --dump
   fron netbeans
nicholas@mordor:~/NetBeansP ...
Score: 0
mohamed rabiaa avatar
Open JDK error when I Install Android Studio Arctic Fox on Xubuntu?
cn flag

I am trying to install Android Studio Arctic Fox on my Xubuntu 20.04 using the official guide from here : https://developer.android.com/studio/install#64bit-libs

I downloaded the .zip file and unzip it into the /opt/ directory but the problem is when I go to the bin folder of android-stuido and open the terminal and run the commnad ./studio.sh to install Android Studio I get this error in the terminal: ...

Score: 0
Nicholas Saunders avatar
how to use testng directly from bash?
mx flag

I'm not seeing why java cannot find App as it's explicitly added to the classpath:

nicholas@mordor:~$ 
nicholas@mordor:~$ java -cp /usr/share/maven-repo/org/testng/testng/debian/testng-debian.jar:/home/nicholas/NetbeansProjects/testng_gradle/src/main/java/testng_gradle/App /home/nicholas/NetBeansProjects/testng_gradle/app/src/test/java/testng_gradle/AppTest.java /home/Nicholas/NetbeansProjects/tes ...
Score: 0
BioX 4.6 won't launch: "An illegal reflective access operation has occurred."
vu flag

BioX won't launch when using JRE 11 on two PCs running Ubuntu 20.04.2 and Pop!_OS 21.04.

The BioX program however works fine without problems in openSUSE (Leap 15.2 and 15.3) which I replaced with Ubuntu 20.04 and Pop!_OS 21.04, respectively.

The error message starts with "An illegal reflective access operation has occurred."

(base) bcramer@curie:~/Biographics_Lab-3R/BioX$ java -jar BioX4.6.13.jar 

llb: ...
Score: 0
Max B avatar
Systemd does not write to StandardOutput with java program
in flag

I have this service file to start my Java application

[Unit]
Description=StorageWebServer

[Service]
WorkingDirectory=/opt/StorageWebServer
ExecStart=/opt/java/openjdk/jdk-16.0.2/bin/java -jar /opt/StorageWebServer/StorageWebServer.jar
User=jvmapps
Type=simple
Restart=on-failure
RestartSec=10
StandardOutput=file:/opt/log.log   
StandardError=file:/opt/log2.log


[Install]
WantedBy=multi-user.target ...
Score: 0
shashI avatar
"Text Editor" is not responding
cn flag
  1. ubuntu 20.04 LTS

  2. shell version - GNOME Shell 3.36.9

  3. gedit version - gedit - Version 3.36.2

When I click 'wait' nothing happened:

Gedit ScreenShot

What I did:

I run gedit from termial and its not come back to my home path. So I input ctrl+Z.

Terminal ScreenShot

Score: 0
Adi Beast Gamer avatar
Unable To Play Minecraft Multiplayer On Any Server
vn flag

Hello Guys I am Adi a New Ubuntu user currently using the latest version of Ubuntu 20.04LTS I was Playing Minecraft good till yesterday From today I am Unable to play on any minecraft server Its too laggy, My Internet is fine and my ping on speedtest.net is 3ms I am using java-8 as the minecraft guide shows, I litreally did everything clearing cache, restarting, reinstall launcher, reinstalling minecraf ...

Score: 0
HELP PLZZZZZ avatar
How do fix problem when downloading minecraft launcher on a chrome book
cn flag
The following packages have unmet dependencies:
  minecraft-launcher: Depends: default-jre but it is not installable
                      Depends: libasound2 (>= 1.0.23) but it is not installable
                      Depends: libatk-bridge2.0-0 (>= 2.5.3) but it is not installable
                      Depends: libatk1.0-0 (>= 2.2.0) but it is not installable
                      Depe ...
Score: 1
unrecognized algorithm name: PBEWithSHA1AndDESede
mk flag

I am trying to use elasticsearch-certutil to generate a certificate

sudo /usr/share/elasticsearch/bin/elasticsearch-certutil cert -out /usr/share/elasticsearch/config/elastic-certificates.p12 -pass ""

I am getting the following error:

java.security.KeyStoreException: Key protection  algorithm not found: java.security.UnrecoverableKeyException: Encrypt Private Key failed: unrecognized algorithm na ...