VirtualMachine.attach failing - java

I wrote a program that uses the VirtualMachine attach API to dynamically attach to a jar. My machine is 64 bit, and the only reason I can think of that would stop is because of my messing around with the environment variables of java(no java_home was set and I tried to fix it). Since getting this error, I have reinstalled both the JDK and JRE to no avail. My guess is that it is some sort of problem loading attach.dll, which is 64 bit.
Anyone have suggestions?
Stack trace of error:
at sun.tools.attach.HotSpotAttachProvider.listVirtualMachines(HotSpotAttachProvider.java:92)
at sun.tools.attach.WindowsAttachProvider.listVirtualMachines(WindowsAttachProvider.java:76)
at com.sun.tools.attach.VirtualMachine.list(VirtualMachine.java:147)
at me.stoud.*.JVM.<init>(JVM.java:19)
at me.stoud.helper.*.checkJVM(CheckHelper.java:158)
at me.stoud.helper.*.initiateChecks(CheckHelper.java:39)
at me.stoud.start.Launch.main(Launch.java:33)
Caused by: java.lang.NullPointerException
at sun.jvmstat.perfdata.monitor.protocol.local.LocalVmManager.activeVms(LocalVmManager.java:148)
at sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostProvider.activeVms(MonitoredHostProvider.java:150)
at sun.tools.attach.HotSpotAttachProvider.listVirtualMachines(HotSpotAttachProvider.java:81)
... 6 more
Forgot to include: it's a java.lang.InternalError being thrown

Related

How do I solve this NPE from trying to use Journey Browser

Using journey browser project I have set up a simple maven project in eclipse, using the dependency provided on the page, I have tried to run the code example (also provided on the page)
And I get an NPE:
Exception in thread "main" java.lang.ExceptionInInitializerError
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:1494)
at java.desktop/java.awt.EventQueue.isDispatchThread(EventQueue.java:1086)
at java.desktop/javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1493)
at com.codebrig.journey.JourneyBrowserView.<init>(JourneyBrowserView.java:78)
at com.codebrig.journey.JourneyBrowserView.<init>(JourneyBrowserView.java:71)
at JourneyBrowser.main(JourneyBrowser.java:13)
Caused by: java.lang.NullPointerException
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2646)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1870)
at java.desktop/sun.awt.windows.WToolkit$1.run(WToolkit.java:118)
at java.desktop/sun.awt.windows.WToolkit$1.run(WToolkit.java:115)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.windows.WToolkit.loadLibraries(WToolkit.java:114)
at java.desktop/sun.awt.windows.WToolkit.<clinit>(WToolkit.java:129)
... 12 more
Can anyone explain what is happening and why here, I have tried this on 64bit windows with java Coretto 11(jdk11.0.7_10),I initially found a bug here, relating to loadLibray in open JDK and thought that maybe the problem, I just don't have a good enough understanding to work out how to get around it?
I'm not sure, but I think that Corretto bug is probably the one that is causing the problem. As noted, it is from their "upstream"; i.e the OpenJDK codebase. It was due to regression that appeared in jdk11.0.7 due to a backport of a fix for another problem. Apparently, the fix changes some internal JDK fields and that breaks application code. As JDK-8240521 puts it:
The backport of the JDK-8231584 changes internal JDK fields processing. The problem is that the many third-party applications copy-pasted a hack that depends on particular JDK implementation.
If I am reading the Oracle bug entries correctly, the reversion of the broken fix should be in JDK11.0.8. Alternatively, an earlier JDK 11 release than 11.0.7 shouldn't have the broken fix.
Let me know if changing your Java 11 install solves the problem. (If not, I'll see if I can get the line numbers to match up.)

Processing on Java error on Mac OS

I got this error message in the console when I tried to run, I just switched laptops and I've wiped my old one. This project has always been stored in a USB so I use that to run it on my new laptop. (So I had to re-download all the applications), I need this to fix so bad due to its my project for class and I haven't record it and I'm supposed to do that and I don't want to fail the class please could u help thank u:
java.lang.NoClassDefFoundError: com/apple/eawt/QuitHandler
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3119)
at java.base/java.lang.Class.getMethodsRecursive(Class.java:3260)
at java.base/java.lang.Class.getMethod0(Class.java:3246)
at java.base/java.lang.Class.getMethod(Class.java:2065)
at processing.core.PApplet.runSketch(PApplet.java:10751)
at processing.core.PApplet.main(PApplet.java:10548)
at processing.core.PApplet.main(PApplet.java:10530)
at robothead.Robothead.main(Robothead.java:8)
Caused by: java.lang.ClassNotFoundException: com.apple.eawt.QuitHandler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
... 9 more
I at first download JDK 10 and I read it only works with JDK 8 so I download that and delete JDK 10 in hopes that stuff will return back to normal and it does not works. Also the project, I did it in java oxygen and I downloaded photon on my new laptop and click on the yes I want to convert the files thing so I decided to make a new workspace and copy paste the code but still got that error?Before it was MacBook Air and I switch to the MacBook Pro.
You are mixing up a lot of things.
The basic problem is that starting with Java 9 oracle made changes that lead to such errors ( see https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-C86F7403-7D7C-456F-8873-18C7F1BEDE2F).
So, in order to get this to work, you have to ensure that Java 8 is used. And that your Java 10 installation was really, fully removed. You should then check your eclipse settings to also ensure that it is pointing to Java 8.

How to update timzone settings in Jre?

I am currently working on a project where in three location the timezones are coming incorrectly.I tried updating my tzmappings file from jre 1.8 .In this process I could able to see the correct time in one location and other location time are still wrong.We embedded the jre with our application and for that we were using jre 1.6.I understand upgrading to new jre i.e jre 1.6->Jre1.8 will be solve this problem.But let me know if anything apart from this i can do to resolve this.
Update: Tried running TZupdater but ends up getting NPE detail stack trace below
Exception in thread "main" com.sun.tools.tzupdater.TzRuntimeException: java.lang.NullPointerException
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:662)
Caused by: java.lang.NullPointerException
at com.sun.tools.tzupdater.TimezoneUpdater.run(TimezoneUpdater.java:215)
at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:643)

Eclipse shows empty error message with Java 9

I have installed the Java 9 plugin. My project hasn't changed, but when I try to run, I get this:
If you need anything else, feel free to comment that you don't have enough info.
My .log file: https://pastebin.com/SQXZVcQk
Seems like a configuration issue as per my understanding. There are two possible causes/solution to it:
From the logs:
Root exception:
java.lang.ExceptionInInitializerError
at com.jniwrapper.util.ProcessorInfo.b(SourceFile:95)
Caused by: com.jniwrapper.LibraryNotFoundException: Cannot find JNIWrapper native library (jniwrap64.dll) in java.library.path:
Eclipse is not able to configure the java.library.path properly, in which case you can try setting the VM argument using the following on the command line:
-Djava.library.path="${workspace_loc:project}\lib;${env_var:PATH}"
Check out How to add native library to "java.library.path" with Eclipse launch (instead of overriding it) for further details and platform specific solutions.
&& make sure you include the path to jdk-9 early access build that should ideally be a must for the plugin used based out of Java9.
Also, the log reads
!ENTRY org.eclipse.ui 4 0 2017-08-27 09:22:31.358
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: -1
at es.org.chemi.games.snake.ui.GameField.createGameField(GameField.java:217)
at es.org.chemi.games.snake.ui.GameField$1.controlResized(GameField.java:99)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:236)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
For the pertaining code, you might want to look into the implementation of
createGameField at GameField.java:217. If this wasn't specifically occurring on previous java version for you then solving (1) should get rid of this or else you might want to give the solutions at Eclipse Bug: Unhandled event loop exception No more handles a try.
On receiving the same error in eclipse I fixed it by selecting this option instead of the default (highlighted by the red arrow in the snapshot)

libgdx bullet example

I try run this code
http://tinfig.com/git/gdx-bullet-demos/
In Windows it does not work and crashes with an error
Caused by: java.lang.RuntimeException: Couldn't load shared library: 'gdx-bullet' for target Windows 7, 32-bit
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:151)
at com.badlogic.gdx.physics.bullet.Bullet.init(Bullet.java:26)
at com.badlogic.gdx.physics.bullet.demo.screens.SimulationScreen.<clinit>(SimulationScreen.java:38)
At Android working fine.
How fix it?
Thanks.
look if you can see gdx-bullet.dll, put it in the current dir, and start the jvm with this parameter -Djava.library.path="."

Categories

Resources