我已经使用了Eclipse很长一段时间,但是最近我刚刚发现了一个错误,它现在真的让我感到困扰,因为我无法使用调试器。我可以正常运行我的程序,但不是调试器。这是我所得到的,当我尝试用调试器中运行:无法使用调试器(无法连接到虚拟机)
'Launching CarLoanUser' has encountered a problem Cannot connect to VM Cannot connect to VM com.sun.jdi.connect.TransportTimeoutException
,并在控制台:
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]
我已经尝试了很多东西与它有关:
- 重新启动Eclipse
- 重新启动我的电脑
- 尝试其他代码我自己的
- 重新安装的Eclipse(露娜)
- 删除蚀(月亮)和与Eclipse的Java EE更换(开普勒)
- 反悔的Eclipse(月神)
- 卸载所有Java的安装实例的Java 8
- 卸载Java的8和安装Java 7(所有Java安装与64位installator)
- 清洁
我目前在Windows上运行8.1与CCleaner的登记中心的64位
如果它可能会帮助,我会包括我目前正在对
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
代码和方法类:
/**
* @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
程序应该工作,我想要它做的。我知道它需要一些工作,但是。
注意:如果防火墙阻止或不阻止,我已经检查了几次。我肯定需要检查资源监视器,并在调试之前等待javaw实例死掉。出于某种原因编译杀死当前进程而不是调试。 – Johns 2015-12-23 13:06:52