草庐IT

property_types

全部标签

java - MyEclipse 中的 "build.properties does not exist"错误

我使用MyEclipse8.6.1开发我的应用程序。我在某些项目中收到“build.properties不存在”错误,但工作区编译和运行没有问题,仅在项目根目录中显示错误图像(红色图像)。我在frume中搜索以解决此问题,在某些情况下会说“此问题的原因是或在.project文件中”,但我看不到此文件有任何问题。 最佳答案 我通过以下方式解决了这个问题:项目/属性/build者取消选中所有构建器提交项目/属性/build者重新检查所有构建器提交 关于java-MyEclipse中的"bui

java - 获取 Class<T> 的实例 [Runtime-Type Token]

我创建了一个Preferences类,并且我不想为Getters使用运行时类型token。所以这是我的getter方法:publicTget(Stringkey,Classclazz){//dosomecrazystuff(e.g.DoubleFloat)}到目前为止,一切正常。但我希望类参数是可选的。booleanb=preferences.get(key);所以我添加了一个额外的方法:publicTget(Stringkey){//returnget(key,Class);}现在问题:有没有办法做到这一点?有没有办法获取Class的实例?.可以通过一个小的解决方法:publicTg

java - 需要不兼容的类型 : Class<T> found: Class<CAP#1> where T is a type-variable

以下代码:publicclassA{Classklass;Tinstance;publicA(Tinstance){this.klass=instance.getClass();//thisrequiresanexplicitcasttoClasstosatisfythecompilerthis.instance=instance;}}编译时给出:A.java:7:error:incompatibletypesthis.klass=instance.getClass();^required:Classfound:ClasswhereTisatype-variable:TextendsO

java - 处理/java : cannot invoke length() on the array type boolean[]

这个问题在这里已经有了答案:lengthandlength()inJava(8个答案)关闭7年前。很惊讶这还没有发布。我正在制作一个for循环,它以前工作过,但由于某种原因我找不到boolean数组的长度。for(intz=0;z

java - Eclipse 3.5.1 编译器错误 :The type OutputFormat is not accessible due to restriction on required library . ./rt.jar

这个错误很奇怪,我无法理解它。我已经安装了EclipseRCP3.5.1,JavaSE1.6更新16并切换到SWT3.5。我创建了一个新项目,设置了依赖项并尝试编译。尝试导入时,请使用以下内容:importcom.sun.org.apache.xml.internal.serialize.OutputFormat;importcom.sun.org.apache.xml.internal.serialize.XMLSerializer;我得到错误:Accessrestriction:ThetypeXMLSerializerisnotaccessibleduetorestrictiono

java - 如何将 logging.properties 添加到 Eclipse 项目的类路径?

我正在使用Eclipse3.7.1,但我的代码没有看到我的logging.properties文件。(我认为它会自动看到它,因为它位于JRE中的标准位置,但这显然是错误的)。有人告诉我需要将此文件添加到类路径的根目录中,但我不确定该怎么做。Eclipse为我提供了将jar、库、变量和其他内容添加到类路径的方法,但我不知道如何添加属性文件。任何人都可以告诉我吗?您可能认为添加一个简单的文本文件比添加一个jar文件更容易,但我没有看到任何文本文件或属性文件的选项,所以我不确定如何继续。 最佳答案 右键单击您的项目->运行/调试设置->编

java - 我可以将 Eclipse 设置为忽略 "Unhandled exception type"

是否可以让Eclipse忽略错误“未处理的异常类型”?在我的具体情况下,原因是我已经检查过文件是否存在。因此,我认为没有理由放入trycatch语句。file=newFile(filePath);if(file.exists()){FileInputStreamfileStream=openFileInput(filePath);if(fileStream!=null){还是我遗漏了什么? 最佳答案 IsitpossibletogetEclipsetoignoretheerror"UnhandledexceptiontypeFile

java - spring - 从 application.properties 文件中读取环境变量

我在application.properties文件中指定了Spring属性。我如何从环境变量中填充这些属性?这是我试过的,但似乎不起作用:application.propertiesspring.datasource.url=jdbc:postgresql://#{systemProperties['DATABASE_HOST']}:5432/dbnamespring.datasource.username=postgresspring.datasource.password=postgres 最佳答案 您可以像使用${...}语

java - Spring MVC 3.0 : Is String the preferred type to be used for @PathVariable?

请原谅我在这里问这么简单的问题,因为我是SpringMVC3.0的新手。我一直在阅读spring源网站上的文档几次。这是我将在下面的问题中引用的代码片段:-@RequestMapping("/pets/{petId}")publicvoidfindPet(@PathVariableStringpetId,Modelmodel){//implementationomitted}如果我打算使用基于此示例的URI模板,将@PathVariable类型设置为String是否总是更可取,即使我希望它是其他类型,例如int?文档说@PathVariable注释可以是任何简单类型,但是如果Sprin

java - 日期格式错误 java.sql.SQLException : Invalid column type

我使用pattern="dd-MMM-yyyy"在JSF中显示日期。当我尝试将日期值插入/更新到我的oracle数据库中时,我得到了java.sql.SQLException:Invalidcolumntype因为我插入或更新前的日期格式是这种格式WedFeb0900:00:00AST2011我如何才能正确地将我的日期值插入或更新到OracleDb以及执行此操作的最佳方法是什么?更新1我的数据库插入代码。privatevoideditSchedule(Scheduleschedule)Object[]values={schedule.getStartDate(),schedule.ge