草庐IT

load_file

全部标签

java - 模式语法异常 : Unexpected internal error near index 1 for `.split(File.separator)` under windows

下面的代码片段在linux下工作正常,但在windows下给我错误(这很奇怪,因为jvm/jdk应该是操作系统不可知的)。Filef=...String[]split=f.getPath().split(File.separator);这里是错误:java.util.regex.PatternSyntaxException:Unexpectedinternalerrornearindex1\^atjava.util.regex.Pattern.error(UnknownSource)atjava.util.regex.Pattern.compile(UnknownSource)atja

java - org.openqa.selenium.WebDriverException : unknown error: cannot determine loading status

我是Selenium的新手,需要一些线索来找到以下错误的根本原因。Selenium版本-3.5.3ChromeDriver版本-2.29.4Chrome版本-63org.openqa.selenium.WebDriverException:unknownerror:cannotdetermineloadingstatusfromunknownerror:missingorinvalid'entry.level'(Sessioninfo:chrome=63.0.3239.132)(Driverinfo:chromedriver=2.29.461591(62ebf098771772160f

java.util.zip.ZipException : too many entries in ZIP file

我正在尝试编写一个Java类来提取包含约74000个XML文件的大型zip文件。尝试使用javazip库解压缩它时出现以下异常:java.util.zip.ZipException:ZIP文件中条目太多不幸的是,由于项目的要求,我无法在zip到达我之前对其进行分解,并且解压缩过程必须自动化(无需手动步骤)。有什么方法可以利用java.util.zip或某些第3方Javazip库来解决此限制?谢谢。 最佳答案 使用ZipInputStream而不是ZipFile应该可以做到这一点。 关于j

JAR 中的 Java Desktop.open(File f) 引用文件?

Desktop.open(Filef)可以引用位于JAR中的文件吗?我尝试使用ClassLoader.getResource(Strings),将其转换为URI,然后从中创建文件。但这会导致IllegalArgumentException:URIisnothierarchical。URLurl=ClassLoader.getSystemClassLoader().getResource(...);System.out.println("url="+url);//urlisvalidDesktop.getDesktop().open(newFile(url.toURI()));一种可能性

Java : Expose only a single package in a jar file

我想要一个只有API包可以访问的jar文件。所有其他包(包含实现)将无法被另一个jar(或任何其他类)访问。这可能吗?如果是,怎么办? 最佳答案 当前计划用于Java8(2012年?)的是JSR294.此JSR将更好的模块化语言结构引入Java。Today,animplementationcanbepartitionedintomultiplepackages.Subpartsofsuchanimplementationneedtobemoretightlycoupledtoeachotherthantothesurrounding

java - maven 安装仅在第二次尝试后抛出 "error in opening zip file"

我尝试在我的项目上使用一些依赖项运行maveninstall:log4jlog4j1.2.15org.slf4jslf4j-log4j121.5.2ch.qos.logbacklogback-classic0.9.24org.hibernatehibernate-core3.3.2.GAorg.hibernatehibernate-annotations3.4.0.GA我第一次运行mvninstall它运行得很好(构建成功)但是第二次(“在我对代码进行一些更改之后”)我尝试运行mvninstall并且maven抛出“打开zip文件时出错”。[ERROR]error:errorreadi

Java 错误 - 错误的源文件 : file does not contain class x . 请删除或确保它出现

最近为了考试开始学习Java。在学习包时,尝试了这个并得到了一条错误消息。我做的是//CreatingclassA(Withinpackagethepackage:com.test.helpers)packagecom.test.helpers;publicclassA{publicvoidsayHello(){System.out.println("HelloWorld");}}//AndthentheclassApputilisingtheclassAimportcom.test.helpers.*;publicclassApp{publicstaticvoidmain(Strin

java - 使用 java.nio.file.Paths 接口(interface)时缺少方案 (IllegalArgumentException)

这是一个非常简单的Java问题。我在linux系统上使用Java8和eclipsekepler。我一直在尝试NIO.2。我的代码是:packagelucasTest;importjava.io.IOException;importjava.net.URI;importjava.net.URISyntaxException;importjava.nio.file.*;publicclassLucas{publicstaticvoidmain(String[]args)throwsURISyntaxException{URIu=newURI("./Lucas.java");Pathp=Pa

java - 每个子类继承关系表 : How to query against the Parent class without loading any subclass ? ?? ( hibernate )

假设一个每个子类继承关系的表可以在下面描述(来自wikibooks.org-参见here)注意父类不是抽象的@Entity@Inheritance(strategy=InheritanceType.JOINED)publicclassProject{@Idprivatelongid;//Otherproperties}@Entity@Table(name="LARGEPROJECT")publicclassLargeProjectextendsProject{privateBigDecimalbudget;}@Entity@Table(name="SMALLPROJECT")publi

java.sql.SQLException : Unable to load class: com. mysql.jdbc.驱动程序

我希望能够将我的程序连接到数据库。但由于我在遵循此处的教程之前从未使用过数据库:https://www.javacodegeeks.com/2016/03/springboot-working-jdbctemplate.html.完成本教程的所有步骤(据我所知)后,我得到以下堆栈跟踪:java.sql.SQLException:Unabletoloadclass:com.mysql.jdbc.DriverfromClassLoader:sun.misc.Launcher$AppClassLoader@34a245ab;ClassLoader:sun.misc.Launcher$AppC