我已經使用了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