java ant 编译在同一包的同一目录中找不到 class
java ant compile does not find class in same directory in same package
我尝试通过 cmd JUnit/Selenium 测试用 ant 编译。我不能使用 eclipse,因为它破坏了 Intellisense。
我在同一目录和同一包中添加了具有相同文件名的 "AssertionCustomException" public class:
package de.auticon.zeiterfassung;
/**
* My custom exception class.
*/
public class AssertionCustomException extends Exception
{
//Parameterless Constructor
public AssertionCustomException() {}
public AssertionCustomException(String message)
{
super(message);
}
}
但是抛出命令:
if (error){
throw AssertionCustomException;
} else {
try {
className = "has-error";
input = driver.findElement(By.className(className));
result = input.isDisplayed();
System.out.println("Page contains error: " + result);
assertTrue("Error: displayed", result);
} catch (NoSuchElementException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
fail("No Error message");
}
}
报错:
[javac] C:\Source\workspace4\ahub\src\de\auticon\zeiterfassung\Test_enter_day.java:247: error: cannot find symbol
[javac] throw AssertionCustomException;
[javac] ^
[javac] symbol: variable AssertionCustomException
[javac] location: class Test_enter_day
感谢任何帮助!
我们添加了throw new AssertionCustomException();
,感谢Jameson给出正确答案!
我尝试通过 cmd JUnit/Selenium 测试用 ant 编译。我不能使用 eclipse,因为它破坏了 Intellisense。 我在同一目录和同一包中添加了具有相同文件名的 "AssertionCustomException" public class:
package de.auticon.zeiterfassung;
/**
* My custom exception class.
*/
public class AssertionCustomException extends Exception
{
//Parameterless Constructor
public AssertionCustomException() {}
public AssertionCustomException(String message)
{
super(message);
}
}
但是抛出命令:
if (error){
throw AssertionCustomException;
} else {
try {
className = "has-error";
input = driver.findElement(By.className(className));
result = input.isDisplayed();
System.out.println("Page contains error: " + result);
assertTrue("Error: displayed", result);
} catch (NoSuchElementException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
fail("No Error message");
}
}
报错:
[javac] C:\Source\workspace4\ahub\src\de\auticon\zeiterfassung\Test_enter_day.java:247: error: cannot find symbol
[javac] throw AssertionCustomException;
[javac] ^
[javac] symbol: variable AssertionCustomException
[javac] location: class Test_enter_day
感谢任何帮助!
我们添加了throw new AssertionCustomException();
,感谢Jameson给出正确答案!