我们可以重新分发Oracle tools.jar吗?

Oracle JDK附带的tools.jar是否可以与依赖它的商业产品一起分发(即,根据Oracle许可证的条款,合法地)? 无论是或否,请提供证据certificate您的答案。

Javagenerics对map的键和值强制执行相同的类型

我在找什么: 我正在构建一些在地图的键和值上强制执行类型的东西:有点像Map<Key, Value> 。 但是,我还想在每个键/值条目中强制执行类型匹配,但在条目之间 ,不应强制执行任何类型。 例如,在同一个映射中,这些键/值对应被视为有效: Key映射到Value Key映射到Value Key映射到Value 但是,这样的事情将是无效的: Key映射到Value Key映射到Value 如何使用Javagenerics完成此操作? 我不想要的: 我知道我可以实现类似Set东西,其中pair接受相同类型的Key / Value。 但是,按键查看这个不再是一个恒定的时间操作。 我知道我可以执行类似Map<Key, Value>并断言Key和Value在运行时是相同的类型。 但是,我想知道这是否可以严格使用generics。

SWT FileDialog:选择目录而不是文件

我可以使用SWT FileDialog来选择文件夹而不是文件吗?

无法弄明白如何

试图获取公司列表,但它给了我一个错误。 type Exception report message tag ‘select’, field ‘list’, name ‘workOrder.company’: The requested list key ‘listAllCompanys’ could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} – [unknown location] description The server encountered an internal error that prevented it from fulfilling this request. 例外: org.apache.jasper.JasperException: tag ‘select’, field ‘list’, name ‘workOrder.company’: The requested […]

如何使用Jsoup获取表单validation码图像?

我正在为我的学校网站开发一个应用程序,我正在使用jsoup来解析html。 我遇到了validation码图像的问题我看到了这个问题而且我已经实现但是我没有得到与网站上显示的相同的图像。 如何获得相同的图像validation码,网站使用BotDetectCaptcha我有点困惑我怎么能在我的网站上专门做到这一点 学校网站

如何从资源文件夹中获取文件。 Spring框架

我正在尝试解组我的xml文件: public Object convertFromXMLToObject(String xmlfile) throws IOException { FileInputStream is = null; File file = new File(String.valueOf(this.getClass().getResource(“xmlToParse/companies.xml”))); try { is = new FileInputStream(file); return getUnmarshaller().unmarshal(new StreamSource(is)); } finally { if (is != null) { is.close(); } } } 但我得到这个错误:java.io.FileNotFoundException:null(没有这样的文件或目录) 这是我的结构: 为什么我无法从资源文件夹中获取文件? 谢谢。 更新。 重构后, URL url = this.getClass()。getResource(“/ xmlToParse / companies.xml”); 文件file = new File(url.getPath()); […]

无法找到或加载主类com.sun.tools.javac.Main hadoop mapreduce

我正在努力学习MapReduce,但我现在有点迷失了。 http://hadoop.apache.org/docs/r2.6.0/hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduceTutorial.html#Usage 特别是这套说明: Compile WordCount.java and create a jar: $ bin/hadoop com.sun.tools.javac.Main WordCount.java 当我在终端输入hadoop ,我能够看到提供参数的“帮助”,所以我相信我已经安装了hadoop。 当我输入命令时: 编译WordCount.java并创建一个jar: hadoop com.sun.tools.javac.Main WordCount.java 我收到错误: Error: Could not find or load main class com.sun.tools.javac.Main 我知道我已经安装了Java并在我的计算机上工作,因为我之前使用它来创建其他程序。 此命令输出: $ /usr/libexec/java_home /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home 也许我错过了一套Java工具? 不确定

用于Java中文件传输的FTP客户端服务器模型

好吧,我正在尝试用Java实现ftp服务器和ftp客户端。 我试图从服务器接收文件。 以下是代码行。 我能够实现服务器和客户端之间的连接,但也无法将文件名发送到服务器。 那么有人可以指导我这种方法是否正确,或者如果没有,请建议适当的更改。 服务器的实现: import java.net.*; import java.io.*; class MyServer { ServerSocket ss; Socket clientsocket; BufferedReader fromclient; InputStreamReader isr; PrintWriter toclient; public MyServer() { String str = new String(“hello”); try { // Create ServerSocket object. ss = new ServerSocket(1244); System.out.println(“Server Started…”); while(true) { System.out.println(“Waiting for the request…”); // accept the client request. clientsocket […]

如何在java GUI中查看复选框的状态?

我在Java GUI中有大约200个复选框。 现在,我希望获得用户已检查过的所有复选框的列表。 我可以用这样的方式做到这一点: jCheckBox1.isSelected(); 但是我不想为200个复选框写这行。 有没有办法通过for循环来做到这一点。 所有复选框的名称都是jCheckBox1,jCheckBox2,jCheckBox3,jCheckBox4 … jCheckBox200

Java SimpleDateFormat返回意外结果

我正在尝试使用Java的SimpleDateFormat来解析使用以下代码的String。 public class DateTester { public static void main(String[] args) throws ParseException { String dateString = “2011-02-28”; SimpleDateFormat dateFormat = new SimpleDateFormat(“MM-dd-yyyy”); System.out.println(dateFormat.parse(dateString)); } } 我期待一些解析错误。 但有趣的是,它会打印以下字符串。 Wed Jul 02 00:00:00 IST 195 无法推理出来。 有人可以帮忙吗? 谢谢