I created a scraping program in java using the ui4j library, but it turns out that I have to run it on a VM where a browser is not present.
Is there a way around it? Do I have to install a browser?
if yes do I need a proper one or a text based browser can do? (I don't think so, but i am asking just in case.)
Thanks, Ilias
EDIT:
This is the error i am getting from the VM. From the line saying Unable to open DISPLAY, i assumed there was a problem with the browser. What might b the problem then?
Exception in thread "Thread-1" java.lang.UnsupportedOperationException: Unable to open DISPLAY
at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:68)
at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatform Factory.java:41)
at com.sun.glass.ui.Application.run(Application.java:146)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java: 263)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:695)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
at com.sun.javafx.application.LauncherImpl$$Lambda$29/1893654604.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
It turns out that i had to enable the Headless Mode of the ui4j as mentioned on the readme file.
Related
I am trying the Nand2Tetris course, and I got to the point where I want to run and test hdl files with the Hardware Simulator. I downloaded the software suit, followed the instruction below and ran:
# I had a dangling symlink issue at the beginning
# and the full path was apparently the way to solve it
chmod +x ~/.../nand2tetris/tools/HardwareSimulator.sh
I tried to run the script with:
./HardwareSimulator.sh
and received the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-17-openjdk-amd64/lib/libawt_xawt.so
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2393)
at java.base/java.lang.Runtime.load0(Runtime.java:755)
at java.base/java.lang.System.load(System.java:1953)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:384)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:228)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:170)
at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:311)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:281)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2398)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1392)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1390)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1389)
at java.desktop/java.awt.Toolkit.initStatic(Toolkit.java:1427)
at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1401)
at java.desktop/java.awt.Component.<clinit>(Component.java:624)
at HardwareSimulatorMain.main(Unknown Source)
I don't understand what seems to be the problem and why it states (Unknown Source) at the end.
When looking online for a solution I saw it might be a problem with openjdk in this post.
I also found this post but it didn't help me much either.
I am a relatively new Linux user currently on pop OS.
I would really love some help as I am unsure what should I do to fix the problem as well as how to continue the course
Thanks in advance.
Not a linux user but a useful tactic in these cases is to google the first line of the error message ("Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-17-openjdk-amd64/lib/libawt_xawt.so"), which provides several hints. One of them is to install the missing library, ie: "sudo apt install openjdk-17-jdk"
My application uses javafx 11.0.1 and is shipped bundled with a jlinked version of openjdk 11. It runs fine for the vast majority of the users but few of them are getting this stack:
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>
at com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)
at com.sun.glass.ui.Screen.initScreens(Screen.java:412)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:152)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:695)
at com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:313)
at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:258)
at com.sun.glass.ui.Application.lambda$run$1(Application.java:153)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Unknown Source)
I found some discussion related to the same exception but regarding Maven+Eclipse, here and here. The issue is very similar, user reporting it, do have other java installations and uninstalling them solves the issue, so basically leaving my bundled openjdk as the only option the application starts, but if there is another Java installed on the system, the wrong .dll is picked up and the application crashes with the above stacktrace.
I tried the suggested java.library.path workaround but users are saying it doesn't solve. Unfortunately I cannot reproduce it myself, any idea on how to solve it or what to ask the users reporting it?
EDIT: we fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.
We fixed the exe generated by lauch4j here and the bash script here. The idea is basically to restrict/change the PATH env variable to avoid the wrong dll being picked up.
I'm running a Java app in Eclipse EE Oxygen 32 bit in a 64 machine since the program will be transferred to a 32 bit machine later. The app is connected to mysql installed through Wampserver, and the server I'm using in the app is Apache Tomcat 8.0.35. When I run the app in "Run as> Run on Server" inside Eclispe. I get the following error message in "Console":
Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1372)
at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1042)
at com.mysql.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders(AbandonedConnectionCleanupThread.java:90)
at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:63)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
How can I debug that?
The java code is totally portable across 32-bit and 64-bit platforms, doesn't make sense to use a 32 bit Eclipse version.
To solve your issue, just restart the Tomcat server to get rid of the older cache then try again.
If still doesn't work:
Restart Eclipse
Clean up Eclipse working directory (see #nitind comment).
Run Eclipse in clean mode (see this)
I try to run the JavaFX sample program, Henley Car Sales, from Oracle [site][1],
http://download.oracle.com/otndocs/products/javafx/samples/DataApp/
[1]: ,http://download.oracle.com/otndocs/products/javafx/samples/DataApp/, I tried it on two different machines and on three different browsers on each machine. It will only up for few seconds and then get the following exception:
Missing Permissions manifest attribute in main jar: http://download.oracle.com/otndocs/products/javafx/samples/DataApp/DataAppClient.jar
java.lang.ExceptionInInitializerError
at com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.<clinit>(AbstractMessageReaderWriterProvider.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
I do have the latest Java installed. I don't know what I can do to make it working.
EDIT:
Above link is a valid link and the JavaFX application is there and can be downloaded to your browser automatically after the click. My browsers can run it but only few seconds due to the exception I pasted.
Quote from http://docs.oracle.com/javafx/2/overview/jfxpub-overview.htm :
Note: The DataApp sample has multiple NetBeans projects and cannot be run without some additional setup. The DataAppReadme.html file and the NetBeans project file are in the src\DataApp directory.
Everything else you have to know is explained on that site.
Using R2014b on OS X Yosemite.
Exception in thread "Startup Class Loader" java.lang.UnsatisfiedLinkError: jogamp.common.jvm.JVMUtil.initialize(Ljava/nio/ByteBuffer;)Z
at jogamp.common.jvm.JVMUtil.initialize(Native Method)
at jogamp.common.jvm.JVMUtil.<clinit>(JVMUtil.java:58)
at com.jogamp.common.os.Platform$1.run(Platform.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:179)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:83)
at com.mathworks.hg.peer.JavaSceneServerPeer.initializeJOGL(JavaSceneServerPeer.java:114)
at com.mathworks.hg.peer.JavaSceneServerPeer.<clinit>(JavaSceneServerPeer.java:100)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.mathworks.mde.desk.StartupClassLoader.loadClass(StartupClassLoader.java:258)
at com.mathworks.mde.desk.StartupClassLoader.access$900(StartupClassLoader.java:25)
at com.mathworks.mde.desk.StartupClassLoader$2.run(StartupClassLoader.java:244)
at java.lang.Thread.run(Thread.java:745)
This pops up the moment I start matlab. I am unable to use imagesc() or imshow() and probably loads of other functions, because matlab crashes with Caught unexpected exception of unknown type. instantly.
I'm at my wits end. The matlab install is fresh, and so is the OS. Same problem using the Java from Apple or the Java from Oracle.
EDIT: Response from MathWorks is that integration with Maple breaks everything. Emptying the .maplerc.sh file in the /bin/ directory fixes everything.
This issue is caused by having installed Matlab integration through maple. A file called .maplerc.sh is placed within the /bin/ folder in the matlab .app, and it apparently breaks everything. You cannot delete the file (this causes matlab to not launch on start up) but you can erase its contents. This will create an error upon launch, but you can ignore it and everything will work fine.
Uninstall matlab and maple, and reinstall maple and matlab without integration will fix the issue entirely.
Replace the contents of the file /Applications/MATLAB_R2014b.app/bin/.maplerc.sh by an empty line (as suggested by the other answer from Dorako), and
Modify the file /Applications/MATLAB_R2014b.app/toolbox/local/matlabrc.m, by searching for Maple in this text file and comment-out or remove the part between the two lines containing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.
The second step ensures that there is no error or warning message any more on startup, so that re-installing the programs is not necessary.