Got 'Failed to initialize graphics environment' when launching idea/pycharm/goland using WSL2 - WSLg - intellij-idea

What doesn't work
I'm trying to setup WSL2 GUI environment under the latest version Windows Insider Preview. Gedit and Thunar worked fine but when I tried to run GoLand it gave me the following error
Start Failed
Failed to initialize graphics environment
java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:233)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.desktop/java.awt.Toolkit.getEventQueue(Toolkit.java:1499)
at java.desktop/java.awt.EventQueue.invokeLater(EventQueue.java:1318)
at com.intellij.idea.StartupUtil.lambda$scheduleInitUi$9(StartupUtil.java:347)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
-----
Your JRE: 11.0.11+9-b1341.57 amd64 (JetBrains s.r.o.)
/home/ubuntu/executables/GoLand-2021.1.3/jbr
I'm using WSL2 - Ubuntu-20.04, Windows 11 build 22000.100
What works
start VcXSrv in Windows
$DISPLAY is set to $WINDOWS_IPADDR:0, startxfce4 in wsl2
start GoLand in VcXSrv window
Everything works fine
p.s. I defined a environment variable WINDOWS_IPADDR=$(cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2).
What I have tried
I've tried Pycharm and Idea and both of them displayed the same error.
export DISPLAY=localhost:0 && goland.sh gives the same error.
export DISPLAY=0:0 && goland.sh gives the same error.
export DISPLAY=$WINDOWS_IPADDR:0 && goland.sh will not show this error, but nothing happened.
I tried to install a new openjdk-11 which might be different from openjdk-11-jdk-headless but it didn't change the JRE path used by IntelliJ-idea/GoLand/PyCharm, which is always IDE_INSTALL_PATH/jbr, e.g. goland alwayws use jre in /home/ubuntu/executables/GoLand-2021.1.3/jbr
I'm not familiar with X11 or X-Server so I tried searching for similar issues but few is related. I'm think it might be some kind of compatibility issue with WSLg.
Does anyone know how to fix this error? Any and all help/direction is appreciated.
UPDATE:
I install a new distro and everything just magically work now. However, I mistakenly deleted the original distro so I cannot test it anymore. I guess WSLg cannot work very well with gnome & xfce4 as I've installed both desktop environments in WSL. Think twice before you want to install multiple desktops!

Related

Minecraft 1.12.2 modded server: "problem occured"

I have a minecraft modded server on 1.12.2, and it works for the most part, but it gives me an error.
The minecraft server is
forge-1.12.2-14.23.5.2846-universal.jar, and I'm on lubuntu, using openJDK 10.
I have these mods:
GalacticraftCore-4.0.2.236, GalacticraftPlanets-4.0.2.236, MicdoodleCore-4.0.2.236, and hopperducts 1.5
My system is:
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
I tried reinstalling it, and it worked to get mission libraries(some) and then this came up.
My code to run is:
java -Xmx1G -Xms1G -jar forge-1.12.2-14.23.5.2846-universal.jar
where "forge-1.12.2-14.23.5.2846-universal.jar" is the run file(yes, spelled correctly).
I just expected it to run, but it gave me this error:
A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:70)
at net.minecraftforge.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:34)
Caused by: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at net.minecraft.launchwrapper.Launch.<init>(Launch.java:34)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
... 6 more
For posterity's sake, the issue is openjdk-10. The server .jar file uses something or other that isn't supported by versions of java after 8, and throws this same error you saw, that I spent a while chasing down. There's another relevant thread here. Solution: remove openjdk-10 (or whatever version you're using that isn't 8) with
sudo apt-get remove openjdk-10
and make sure version 8 is installed with
sudo apt-get install openjdk-8.
I found this on GitHub. Basically, the issue may be something with the vannilla Minecraft server.jar. Try re-downloading it, and manually renaming it. If that doesn't fix, there was a comment in there about Linux. Check that out.
Sorry I'm not more help. I'm not a Java developer, and I have just barely used Linux. I used CentOS a bit on my Raspberry Pi, and I used Ubuntu in a virtual machine, but besides that I'm a Windows user.

IntelliJ Startup Error "Cannot Lock System Folders"

I installed IntelliJ IDEA 15.0.1 Community Edition but when I run the application, it displays me the following error message:
Internal error. Please report to http://jb.gg/ide/critical-startup-errors
java.lang.IllegalStateException: failed to create a child event loop
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:81)
at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:50)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:72)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:58)
at org.jetbrains.io.BuiltInServer.start(BuiltInServer.java:78)
at com.intellij.idea.SocketLock$2.call(SocketLock.java:131)
at com.intellij.idea.SocketLock$2.call(SocketLock.java:112)
at com.intellij.idea.SocketLock.underLocks(SocketLock.java:155)
at com.intellij.idea.SocketLock.lock(SocketLock.java:112)
at com.intellij.idea.StartupUtil.lockSystemFolders(StartupUtil.java:263)
at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:101)
at com.intellij.idea.MainImpl.start(MainImpl.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:90)
at java.lang.Thread.run(Thread.java:745)
Caused by: io.netty.channel.ChannelException: failed to open a new selector
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:127)
at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:119)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:97)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:31)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:77)
... 17 more
Caused by: java.io.IOException: Unable to establish loopback connection
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:101)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:68)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.ch.PipeImpl.<init>(PipeImpl.java:170)
at sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50)
at java.nio.channels.Pipe.open(Pipe.java:155)
at sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:127)
at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44)
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:125)
... 21 more
Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:197)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:139)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:83)
... 29 more
The IDE doesn't boot up afterwards. It always worked flawlessly before but recently I have been getting this same error when trying to compile a Java project with IDEA version 14.5. After a clean installation of 15.0.1 it still doesn't work. It becomes quite obvious that the problem must be due to something I installed in the meantime but what could affect IntelliJ IDEA in such a way? I'm on Windows 10 and using AVAST!. I tried disabling my Antivirus and Firewall but it didn't help. I also submitted a bug report. Eclipse still runs and compiles Java code just fine.
It does seem to be AVAST! related. Maybe try to reinstall or deinstall it?
https://youtrack.jetbrains.com/issue/IDEA-146929
https://bugs.mojang.com/browse/MC-34749
I was having the same issue. Disable your firewall or check your security settings.
your firewall and antivirus program is blocking the android studio so remove antivirus program or add android studio.exe in allowed list this helped me
The solution is really easy. You just need to delete all .androidstudio* folders from appdata folder on your PC. Note that i don't know if this folder contains anything important.
Yeah it is a problem with Avast security! I was using studio fine until one day my computer kept slowing down. I read that having 2 anti virus softwares can slow down your pc so i tried installing avast and just stick with Windows Defender. Avast cannot properly uninstall now the software is corrupted or something cause it wont start up. If you can get rid of Avast you will be good to go.
Restarting Windows works for me. But I think it is related to the firewall.
It happened after I closed a Windows Firewall dialogue asking me if another app (Everything.exe) can access the network (workplace, private or public) without response. After I restarted Windows, IntelliJ could launch normally.

Failed to create a child event loop

In IntelliJ IDEA Community Edition 14.0.2, I'm trying to run Java Applet and every time I try to run project, I got this this dummy error.
Error: Failed to create a child event loop
What I've tried
Compiling newly created Hello World program
Update IntelliJ
Uninstall & Reinstall
Allow from Windows Firewall rule
Disabling Antivirus Program
I'm using Windows 8.1 with Anti-virus program Windows Defender.
Error detail from Log file:
java.lang.IllegalStateException: failed to create a child event loop
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:81)
at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:50)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:72)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:58)
at org.jetbrains.io.BuiltInServer.start(BuiltInServer.java:60)
at org.jetbrains.ide.BuiltInServerManagerImpl$1.run(BuiltInServerManagerImpl.java:111)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:405)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
Caused by: io.netty.channel.ChannelException: failed to open a new selector
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:127)
at io.netty.channel.nio.NioEventLoop.<init>(NioEventLoop.java:119)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:97)
at io.netty.channel.nio.NioEventLoopGroup.newChild(NioEventLoopGroup.java:31)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:77)
... 12 more
Caused by: java.io.IOException: Unable to establish loopback connection
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:101)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:68)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.ch.PipeImpl.<init>(PipeImpl.java:170)
at sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50)
at java.nio.channels.Pipe.open(Pipe.java:155)
at sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:127)
at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44)
at io.netty.channel.nio.NioEventLoop.openSelector(NioEventLoop.java:125)
... 16 more
Caused by: java.net.SocketException: Network is unreachable: connect
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:457)
at sun.nio.ch.Net.connect(Net.java:449)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:647)
at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:130)
at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:83)
... 24 more
Restarting intelliJ did not help, restarting machine did!
Disable firewall
or add idea.exe full correct path to outgoing connect rules of your firewall.
It helped me with IDEA 14.0.3
I encountered same error when we deploy our application to a Windows Server, however, this server has no antivirus software and the firewall is disabled. In our case, it's due to the Astrill VPN, if we disable the Astrill VPN, the issue would disappear.
My os is Windows, Use Pycharm 2017.3 to run scrapy project encountered a similar problem.
Today, Use Intellij Idea 2016.3.5 to run spring project had the same question.
In my os, Close the Windows Defender can solve this question.
We have to turn off the firewall. It solves the problem. Even in "eclipse" software also turning off the firewall works well.
updating pycharm to a newer version worked for me and then restarting the pycharm ide.

Cannot use jpenable

I am stuck at square one of trying to profile my app using JProfiler. I am trying to use "jpenable" on RHEL6, but when I select my VM, it simply crashes to the desktop as follows:
Please select the profiling mode:
GUI mode (attach with JProfiler GUI) [1, Enter]
Offline mode (use config file to set profiling settings) [2]
1
Please enter a profiling port
[31757]
java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.setSchema(Ljavax/xml/validation/Schema;)V
at org.jdom2.input.sax.XMLReaders.<init>(XMLReaders.java:124)
at org.jdom2.input.sax.XMLReaders.<clinit>(XMLReaders.java:95)
at org.jdom2.input.SAXBuilder.<init>(SAXBuilder.java:338)
at org.jdom2.input.SAXBuilder.<init>(SAXBuilder.java:221)
at com.jprofiler.a.h.a(ejt:500)
<snip so StackOverflow allows the post>
at com.jprofiler.a.i.g.a(ejt:38)
at com.jprofiler.frontend.attach.c.a(ejt:243)
at com.jprofiler.frontend.EnableApplication.a(ejt:118)
at com.jprofiler.frontend.EnableApplication.g(ejt:81)
at com.jprofiler.frontend.EnableApplication.main(ejt:238)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.install4j.runtime.launcher.Launcher.main(Unknown Source)
Any suggestions on what to do? I installed JProfiler 8.0.5 (the current version) from the RPM and simply entered the jpenable command. Everything else is shown above. This is a rather old RHEL6 image, but I cannot upgrade to a more recent one.
I am at a loss for what to try next.
Any help would be greatly appreciated,
Mike
This is because of a conflicting version of one of the following files
xml-apis.jar
xmlParserAPIs.jar
xercesImpl-x.x.x.jar
jaxp-api.jar
in the extension directory ($JAVA_HOME/lib/ext) of the JRE. You would have to remove that file.

"Could not find the main class: com.cloudbees.sdk.boot.Launcher" after installing Cloudbees SDK

I have installed the Cloudbees SDK on my Ubuntu 12.04 system following this doc. When I run bees help I get the following message :
Exception in thread "main" java.lang.NoClassDefFoundError:
com/cloudbees/sdk/boot/Launcher Caused by:
java.lang.ClassNotFoundException: com.cloudbees.sdk.boot.Launcher at
java.net.URLClassLoader$1.run(URLClassLoader.java:217) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:205) at
java.lang.ClassLoader.loadClass(ClassLoader.java:321) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at
java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find
the main class: com.cloudbees.sdk.boot.Launcher. Program will exit.
It's maybe useful to note that I alredy installed an older version of the Cloudbees SDK and I started by uninstalling it by removing the installation folder and the .bees folder in my home directory.
It sounds like your bees command may be trying to launch with jars from an incorrect location. Make sure that your BEES_HOME environment variable is pointing at the same directory where there bees command/script you are running comes from.