Ubuntu Libgdx problem - No X11 DISPLAY variable was set - java

My problem is with X11 variable - when Im trying to launch gdx-setup.jar i get output:
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,
at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
at java.desktop/java.awt.Window.<init>(Window.java:553)
at java.desktop/java.awt.Frame.<init>(Frame.java:428)
at java.desktop/java.awt.Frame.<init>(Frame.java:393)
at java.desktop/javax.swing.JFrame.<init>(JFrame.java:180)
at com.badlogic.gdx.setup.GdxSetupUI.<init>(GdxSetupUI.java:101)
at com.badlogic.gdx.setup.GdxSetup.main(GdxSetup.java:620)
Im running ubuntu on my local laptop (NO SSH).
System details
I've tried commands:
sudo apt-get update --fix-missing
sudo apt-get update
sudo apt-get clean
sudo apt-get autoremove
sudo dpkg reconfigure -a
sudo apt install -f
It didnt help at all...
When Im running AWT from intellij I can see GUI normally and there's no exception.
Ive followed there instructions while installing libgdx:https://tutorialforlinux.com/2022/11/14/step-by-step-libgdx-ubuntu-22-04-installation-guide/2/
echo $DISPLAY
output:0
Installed: xorg-x11
Double clicking on jar causes with no response... Ive marked jar as executable

You can specify one of many installed java versions when running from intellij. When running from the command line its just a single one.I think your default java probably -actually truly is- headless. Follow this guide here to change your default command line java. I mean the error is specifically that if fails the headless check.
Follow here to switch the default cmd line java version.
https://computingforgeeks.com/how-to-set-default-java-version-on-ubuntu-debian/
Its not unusual to have headless because thats all server side stuff needs.

Related

Command Not Found when Installing JPostal on Windows 10

I'm trying to setup JPostal + LibPostal on a Windows 10 PC.
JPostal documentation states that the following command must execute without errors:
pkg-config --cflags --libs libpostal
However, when I execute the above command I get the following error:
bash: pkg-config command not found
The documentation did not state to install any other software to execute the above command. Is there something missing? I'm on Windows 10.
Update:
I re-read the documentation on libpostal which states:
libpostal has support for pkg-config, so you can use the
pkg-config to print the flags needed to link your program against it..
It seems like once I install libpostal the above command should work. Why isn't it working?
Thanks
bash: pkg-config command not found
shows that you are using WSL (Windows Subsystem for Linux) or Cygwin. In either case, you will first have to install the pkg-config package using the command below. Afterward, the setup shall work.
sudo apt install pkg-config

Whenever I run "apt-get install php5-gd php-mysql" it states "Unable to locate package php-mysql" on Ubuntu 14.04

I am trying to run the command
apt-get install php5-gd php-mysql
but whenever I run the command it states this:
E: Unable to locate package php-mysql
My Dedicated Server is running Ubuntu 14.04, it is hosted by So You Start.
The thing is, it was working before, along with java, and mysql, and php.
Is it possible that this is just a side effect of a bigger problem that needs to be fixed? When I try to install java, this shows up:
apt-get install openjdk-7-jre-headless
Reading package lists... Done
Building dependency tree
Reading state information... Done
openjdk-7-jre-headless is already the newest version.
The following packages were automatically installed and are no longer required:
libdbi-perl libterm-readkey-perl mysql-client-core-5.5
Use 'apt-get autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up oracle-java8-installer (8u121-1~webupd8~0) ...
Installing from local file /var/cache/oracle-jdk8-installer/jdk-8u121-linux- x64.tar.gz
Removing outdated cached downloads...
update-alternatives: using /usr/lib/jvm/java-8-oracle/jre/bin/ControlPanel to provide /usr/bin/ControlPanel (ControlPanel) in auto mode
update-alternatives: error: error creating symbolic link `/etc/alternatives/ControlPanel.dpkg-tmp': No such file or directory
No apport report written because the error message indicates it's a follow- up error from a previous failure.
dpkg: error processing package oracle-java8- installer (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of oracle-java8-set-default:
oracle-java8-set-default depends on oracle-java8-installer; however:
Package oracle-java8-installer is not configured yet.
dpkg: error processing package oracle-java8-set-default (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
oracle-java8-installer
oracle-java8-set-default
E: Sub-process /usr/bin/dpkg returned an error code (1)
I'm on 14.04, and php5-mysql is fine:
$ apt-cache search php5-mysql
php5-mysql - MySQL module for php5
php5-mysqlnd - MySQL module for php5 (Native Driver)
php5-mysqlnd-ms - MySQL replication and load balancing module for PHP
Try doing an update first before doing the install:
sudo apt-get update
sudo apt-get install php5-mysql

java command not found on remote machines linux [duplicate]

This question already has answers here:
Java command not found on Linux
(6 answers)
Closed 6 years ago.
i try to run spark application on a cluster standalone mode, when i access to some remote machines and use "java -version" command i get the information(java version ..), but on others i get an error
-bash: command not found
so i thought that maybe java is not installed on those nodes so i tried with:
sudo apt -get install openjdk-8-jdk
but i get the same error, so wanna know how can i fix this, and i have some questions:
-Is it necessary that i install java on all remote machines? or if i install it only on the master node it is enough?
-if i have to install it on each node, how can i fix the problem that i explained before? (can not use install command...)
-In my code, i used expressions that are only supported with jdk 8, but some nodes (in which i could get "java version") it is installed jdk7, so do i have to reinstall jdk8 ?
"command not found" error means that particular command you're trying to invoke is not found in neither of directories listed in $PATH system variable.
There are two ways how to fix this:
1) Specify full path when running an executable:
/opt/jdk-12345/bin/java -version
2) add the very same path to the beginning of PATH (change will be applied to current session only):
export PATH=/opt/jdk-12345/bin:$PATH
java -version
To fix this permanently, add that line (export PATH=/opt/jdk-12345/bin:$PATH) to ~/.bashrc (if BASH is default shell for that user) or to ~/.profile
Also because this is Unix Java, make sure to set up LD_LIBRARY_PATH and CLASSPATH variables if you're running some server applications. Usually this is done in application startup scripts, no need to go global.
Please verify which Server OS you're running ( uname -a or /bin/uname -a ) because different Unix systems have different package managers: apt-get is for Ubuntu/Debian, rpm for RedHat, Entropy for Sabayon/Gentoo, etc...

Building a docker image doesnt stop because of minecraft server continuing to run

So I have been trying to learn docker for a few days now and set a first goal for me.
I want to run a spigot server inside a docker container and later on the road combine that with a BungeeCord network.
I have run into problem.
My dockerfile runs without problems but once it reaches the point where it starts the minecraft server, the images stops building.
I think this is due to the server continuing to run and not returning a code 0 to show docker to keep on running.
Am I wrong with my idea, and if not, how can I fix the problem?
Here is my Dockerfile:
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install openjdk-7-jre icedtea-7-plugin -y
RUN apt-get install wget -y
RUN mkdir mc_server && cd mc_server/
RUN wget http://getspigot.org/spigot18/spigot_server.jar
RUN java -Xms1536m -Xmx1536m -Dcom.mojang.eula.agree=true -jar spigot_server.jar nogui
This way the server starts up but docker never finishes building.
I hope I made my problem clear.
Greetings,
Joel
Replace that last RUN with CMD.
RUN / ADD / .. are used to build the static container environment where you want to run your application in. Everything that happens before running the actual application.
CMD and ENTRYPOINT define what's supposed to happen inside the container once you docker run it. This is where the startup script / call goes for the program.
The result of the Dockerfile is similar to a computer that's shut down but has everything installed on the harddrive including a script that autostarts the application. Turn it on and everything starts to run.
PS: https://hub.docker.com/search/?q=spigot&page=1&isAutomated=0&isOfficial=0&starCount=0&pullCount=0 there are several existing images

java.lang.NoClassDefFoundError: Could not initialize class java.awt.Component

When I run MATLAB install script in Ubuntu, I get the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Component
longer output is available here
I know that it's a Java problem and could potentially be fixed by changing the classpath or something like that but I don't exactly know how.
Any Ideas?
For me this error was fixed when I installed the JRE on my system:
apt-get install default-jre
on Ubuntu 12.04, instead of having MATLAB use its own.
I've been battling this problem for the whole evening as well but I stumbled onto a solution that works for me at least.
After trying to install using the silent installer I got a different error with a bit more information. It turned out that a library was missing (libXtst.so.6). I was able to install that on my Ubuntu system with:
apt-get install libxtst6
After that I tried running the GUI installer (over X forwarding) and it looks like it's going to work now.
For MATLAB R2012a Student Edition, in Ubuntu 14.04, I had to install these prerequisites first:
sudo apt-get install default-jre libxtst6:i386 libXext6:i386 libxi6:i386 libncurses5:i386 libxt6:i386 libxpm4:i386 libxmu6:i386 libxp6:i386
Next I installed/activated per MATLAB's instructions (sudo ./install). I answered "yes" when the installer asked to add a symbolic link in /usr/local/bin/
Finally, when launching MATLAB, I have to specify that it run in 32-bit mode:
matlab -glnx86
I assembled those steps from this answer: https://askubuntu.com/questions/363878/how-to-install-32-bit-matlab-in-ubuntu-64-bit
and the Ubuntu MATLAB guide:
https://help.ubuntu.com/community/MATLAB
Optional
I didn't want to type the -glnx86 option each time I launch MATLAB, so I replaced the matlab symbolic link in /usr/local/bin/ with a script that automatically specifies the -glnx86 option:
ls -l /usr/local/bin/matlab #note the destination of the symbolic link
sudo mv /usr/local/bin/matlab /usr/local/bin/matlab.bak
#ensure the first path below matches your symbolic link's destination
echo '/usr/local/MATLAB/R2012a_Student/bin/matlab -glnx86 "$#"' | sudo tee /usr/local/bin/matlab
sudo chmod +x /usr/local/bin/matlab
With that, I can type 'matlab' and it launches properly. (The "$#" in the script forwards all input arguments to matlab.) There's probably a more elegant way to accomplish this, but it worked.
I also encountered a "/lib/libc.so.6: not found" error on matlab startup, which I fixed by following this answer.
Installing gnome (sudo apt-get install gnome) fixed this problem for me. I'm sure this was total overkill, but the required libraries are now available.

Categories