1

I've Eclipse for quite a while, but I recently just came across an error that is really bugging me right now because I can't use the debugger. I can run my program normally, but not the debugger. This is what I get when I try to run with the debugger:

'Launching CarLoanUser' has encountered a problem Cannot connect to VM Cannot connect to VM com.sun.jdi.connect.TransportTimeoutException

and in the console:

FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) ERROR: transport error 202: connect failed: Permission denied ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]

I've tried a lot of things concerning it:

  • restart Eclipse
  • restart my computer
  • Try another code I own
  • Reinstall Eclipse (Luna)
  • Delete Eclipse (Luna) and replace it with Eclipse Java EE (Kepler)
  • Go back on Eclipse (Luna)
  • Uninstall all instances of Java and install Java 8
  • Uninstall Java 8 and install Java 7 (All Java installation are with the 64-bit installator)
  • Clean the registery with ccleaner

I'm currently running on Windows 8.1 64-bit

If it might help, I'll include the code I'm currently working on

import java.util.Scanner;
import java.text.NumberFormat;

/**
 * Title:  CarLoanUser
 * Description: 
 * @author 
 * @version 1.0
 */

public class CarLoanUser {

/**
 * @param args
 */
public static void main(String[] args) {
    runWithConsole();
}//main(args)

public static void runWithConsole()
{
    NumberFormat money = NumberFormat.getCurrencyInstance();
    Scanner key = new Scanner(System.in);
    CarLoanMethods user;
    int numberOfPayments = 0;
    double remainingAmount, remainingAmountInCalculation; 
    user = new CarLoanMethods();

    System.out.print("What is the model? ");
    user.setModel(key.nextLine());

    System.out.print("What is the loan amount? ");
    user.setLoanAmount(key.nextInt());
    remainingAmountInCalculation = user.getLoanAmount(); 

    System.out.print("What is the interest rate? ");
    user.setInterestRate(key.nextInt());

    System.out.print("What is the monthly payment? ");
    user.setMonthlyPayment(key.nextInt());

    user.calculateEverything();

    System.out.printf("\n%10s%35s", "Car model: ", user.getModel());
    System.out.printf("\n%14s%31s", "Amount to pay: ", money.format(user.getTotalPrice()));
    System.out.printf("\n%33s%12s", "Total interest that will be paid: ", money.format(user.getTotalInterest()));
    System.out.printf("\n%19s%26s", "Number of payments: ", user.getNumberOfPayments());

}//runWithConsole()
}//CarLoanUser class

And the method class:

/**
 * @author 
 *
 */
public class CarLoanMethods {

private String model;
private int loanAmount;
private int interestRate;
private int numberOfPayments = 0;
private double monthlyPayment;
private double interestTotal;
private double interest;
private double toBePaid;

public CarLoanMethods()
{
    model = "Unknown";
    loanAmount = 0;
    interestRate = 0;
    monthlyPayment = 0;
}//CarLoanMethods()

public CarLoanMethods(String userModel, int userLoan)
{
    model = userModel;
    loanAmount = userLoan;
    interestRate = 0;
    monthlyPayment = 0;
}//CarLoanMethods(String, int)

public CarLoanMethods(int userInternetRate, int userMonthlyPayment)
{
    model = "Unknown";
    loanAmount = 0;
    interestRate = userInternetRate;
    monthlyPayment = userMonthlyPayment;
}//CarLoanMethods(int, int)

public void setModel(String userModel)
{
    model = userModel;
}//setModel(String)
public String getModel()
{
    return model;
}//getModel()

public void setLoanAmount(int userLoan)
{
    loanAmount = userLoan;
}//setLoanAmount(int)
public int getLoanAmount()
{
    return loanAmount;
}//getLoanAmount()

public void setInterestRate(int userInterestRate)
{
    interestRate = userInterestRate;
}//setInterestRate(int)
public int getInterestRate()
{
    return interestRate;
}//getInterestRate()

public void setMonthlyPayment(double userMonthlyPayment)
{
    monthlyPayment = userMonthlyPayment;
}//setMonthlyPayment(double)
public double getMonthlyPayment()
{
    return monthlyPayment;
}//getMonthlyPayment()


public double getTotalInterest()
{
    return interestTotal;
}//getTotalInterest()

public double getTotalPrice()
{
    return interestTotal + loanAmount;
}//getTotalPrice

public int getNumberOfPayments()
{
    return numberOfPayments;
}

public void calculateEverything()
{
    double remainingAmountInCalculation = getMonthlyPayment();
    while (remainingAmountInCalculation >= 0)
    {   

        interest = remainingAmountInCalculation * ((interestRate / 100.0) / 12.0);
        interest = Math.round(interest * 100.0) / 100.0;
        remainingAmountInCalculation =  (remainingAmountInCalculation + interest) - monthlyPayment;
        interestTotal += interest;
        ++numberOfPayments;
    }
}
}//CarLoanMethods

The program should work as I intended it to do. I know it need some work, but yeah.

Gunn
  • 11
  • 1
  • 5

2 Answers2

1

I've been having this issue for a while. I couldn't really find a definitive solution (one that makes it work 100% of the time) but at least I can debug.

First you need to check if javaw is already using the port. To do that in Windows you have two options:

  • go to the task manager -> resource monitor -> network.

And there check for listening ports (javaw uses 5001 and 8080)

  • run -> cmd -> and then type: netstat -n

You'll see the ports 5001 and 8080 on listening.

If you see the ports opened is not going to debug. Run the application as normal, stop it, wait a few seconds and check again.

If you don't see them on listening then you can debug, but don't do it through the menus; go to Run -> Debug configurations -> and press debug from there.

I know is not a definitive solution (and this problem is already 1 year old) but that worked for me enough to let me debug and continue developing.

Johns
  • 81
  • 5
  • Note: I already checked a few times if the firewall was blocking it or not. I definitely need to check the resource monitor and wait for the javaw instances to die before I can debug. For some reason compiling kills the current processes whilst debugging does not. – Johns Dec 23 '15 at 13:06
0

This solution says it could be because the port the debugger wants to use it being taken.

I think it could also be a firewall blocking it, make sure that's not the problem.

Community
  • 1
  • 1
Ben Minton
  • 118
  • 5