本文介绍了AttachNotSupportedException:未安装提供程序的Java代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在将Java应用程序附加到远程Java虚拟机时遇到麻烦.我在Windows 7上使用的是Java 8u45,我的附加代码非常简单

I'm having troubles to attach my java app to a remote java vm.I'm using java 8u45 on windows 7 and my attaching code is very simple

import java.io.IOException;
import java.util.List;
import java.util.Scanner;

import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import com.sun.tools.attach.spi.AttachProvider;

public class AgentLoader
{
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String pid = s.next();

        try
        {
            VirtualMachine vm = VirtualMachine.attach(pid);
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }
}

当attach被调用时,我得到AttachNotSupportedException并且没有安装提供程序.我在网上浏览了一些答案,但发现很少有解决方案对我不起作用.就像确保我不会在同一台计算机上混合使用几个版本的Java.将PATH变量设置为指向位于%JAVA_HOME%\ jre \ bin中的attach.dll库等.

when attach being called, I get AttachNotSupportedException and that there's no provider installed.I looked through some answers on the web and I saw few solutions that didn't work for me.like making sure that I don't mix up few versions of java on the same machine.set PATH variable to point to the attach.dll library located in %JAVA_HOME%\jre\binetc..

没有一个为我工作

知道是什么问题吗?谢谢

any idea what could be the issue?Thanks

推荐答案

将IDE的jre依赖项从jre更改为jdk.至于eclipse,则窗口->首选项-> Java->已安装的JRE,将jre替换为jdk.

Change your IDE's jre dependency from jre to jdk.As for eclipse, Window -> Preferences -> Java -> Installed JREs, replace jre with jdk.

这篇关于AttachNotSupportedException:未安装提供程序的Java代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 00:04