Windows 8 Java 7 debugging not working

I am trying to debug an applet on Windows 8 using Java 1.7.0_21.

I added the bleow parameter to the runtime parameters.

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 

When I try to connect, I get the message "Could not open a connection to the host, at port 5005" on local and remote machines.

If I do netstat -an, I do not see any listening on port 5005. It seems that the JVM does not open the debug port for listening.

I added a port to the firewall and even completely disabled the firewall, but no difference.

Has anyone else tried to debug Java 7 on Windows 8?

thank

+5
source share
3 answers

, . , , .

JRE. Java, javaw.exe. , . Process Explorer , , java.exe. , javaw.exe java.exe, -, java.exe.

Java , , . , - , "", "" , , "Java", . , , , .

+2

... !

, : java exe , java

( , dev:))

  • java.exe java.
  • exeFile, java-
  • stdoutRedirect stderrRedirect
  • -static-libgcc -static-libstdc++ mingW

fakeJava.exe

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<time.h>
#include<strings.h>
int main(int givenArgc,char *givenArgv[])
{ 
    std::cout<<"step 0.a\n";
    char exeFile[] = "c:\\java\\jdk1.7.0_21\\bin\\java.exe";
    int prependArgc = 4;
    char* prependArgv[] = {
        "-Djava.compiler=NONE",
        "-Xnoagent",
        "-Xdebug",
        "-Xrunjdwp:transport=dt_socket,address=2502,server=y,suspend=y"
    };


    std::cout<<"step 0.b\n";
    time_t rawtime;
    struct tm * timeinfo;
    char date [80];

    time (&rawtime);
    timeinfo = localtime (&rawtime);

    strftime (date,80,"%Y%m%d%H%M%S",timeinfo);

    std::cout<<"step 0.c\n";
    char stderrRedirect[100];
    char stdoutRedirect[100];
    sprintf(stderrRedirect,"2>d:\\tmp\\%s-stderr.txt",date);
    sprintf(stdoutRedirect,">d:\\tmp\\%s-stdout.txt",date);

    std::cout<<"step 0.d\n";
    int appendArgc = 2;
    char* appendArgv[] = {
        stderrRedirect,
        stdoutRedirect
    };

    std::cout<<"step 0.e\n";
    int argc = prependArgc+givenArgc-1+appendArgc;
    char** argv = (char**)malloc(argc*sizeof(char*)); 

    std::cout<<"step 1.a\n";
    char** src = prependArgv;
    int nbItems = prependArgc;
    int j = 0;
    for(int i=0;i<nbItems;i++){
        argv[j++]=src[i];
    }

    std::cout<<"step 1.b\n";
    src = givenArgv;
    nbItems = givenArgc;
    for(int i=1;i<nbItems;i++){
        argv[j++]=src[i];
    }

    std::cout<<"step 1.c\n";
    src = appendArgv;
    nbItems = appendArgc;
    for(int i=0;i<nbItems;i++){
        argv[j++]=src[i];
    }

    std::cout<<"step 3\n";
    char str[4096];
    strcpy(str,exeFile);
    std::cout<<"step 4\n";
    for(int i =0;i<argc;i++){
        strcat (str," ");
        strcat (str,argv[i]);
    }
    std::cout<<"step 5\n";
    std::cout<<"will run : ";
    std::cout<<str;

    std::cout<<"\nstep 6\n";
    system(str);
    free(argv);
    return 0;
}
+2

JAVA_TOOL_OPTIONS = "- agentlib: jdwp = transport = dt_socket, server = y, suspend = n, address = 8989", bug, ( , Chrome)

, sun bugs, , , , java-8 (b97) sun-bug, ​​ java-8 (b99 - )

+1

All Articles