IllegalArgumentException:No sources given
时间: 2024-05-31 07:06:11 浏览: 18
IllegalArgumentException: No sources given 是Java编程中的一种异常情况,通常表示在编译或执行程序时没有指定源文件。这种情况可能发生在编译器没有找到源文件或者源文件没有被正确指定的情况下。如果你遇到了这个异常,建议检查你的源代码路径是否正确,并且确保在编译或执行时已经正确地指定了源文件。
相关问题
IllegalArgumentException: Cannot format given Object as a Date
引用\[1\]中的错误是因为在使用SimpleDateFormat的format函数时,传入的参数类型不正确。format函数只能接受Date类型的参数,而不能接受其他类型的对象。因此,需要将参数转换为Date类型后再进行格式化。
引用\[2\]中提供了一个小工具类TimeUtil,其中包含了一个将字符串时间格式转换成Date时间格式的方法StringToDate。可以使用这个方法将字符串时间转换为Date类型,然后再使用SimpleDateFormat的format函数进行格式化。
引用\[3\]中给出了解决这个问题的具体方法。首先,将状态中的字符串时间转换为Date类型,然后再使用SimpleDateFormat的format函数进行格式化。具体代码如下:
```java
firstVisitState = getRuntimeContext().getState(new ValueStateDescriptor<String>("firstVisitState", String.class));
sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse(firstVisitState.value() == null ? "1970-01-01 00:00:00" : firstVisitState.value());
String yesterday = sdf.format(date);
```
这样就可以避免IllegalArgumentException: Cannot format given Object as a Date的错误。
#### 引用[.reference_title]
- *1* *3* [[Flink开发总结]java.lang.IllegalArgumentException: Cannot format given Object as a Date](https://blog.csdn.net/LangLang1111111/article/details/121642340)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [java.lang.IllegalArgumentException: Cannot format given Object as a Date](https://blog.csdn.net/weixin_30301449/article/details/95104447)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
IllegalArgumentException: No enum constant
C知道: IllegalArgumentException: No enum constant 通常意味着您正在尝试访问一个枚举类型中不存在的常量。这可能是由于拼写错误或错误的常量名称导致的。请确保您使用正确的常量名称,并且它在所需的枚举类型中存在。如果您能提供更多上下文或代码示例,我可以帮助您更具体地解决问题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)