cmd Error : Could not find or load main class

This question already has an answer here: What does “Could not find or load main class” mean? 39 answers To compile: C:>javac -d . comcheck2pkgs2B.java To run: C:>java -cp . com.check2.pkgs2.B

cmd错误:无法找到或加载主类

这个问题在这里已经有了答案: “无法找到或加载主类”是什么意思? 39个答案 编译: C:>javac -d . comcheck2pkgs2B.java 跑步: C:>java -cp . com.check2.pkgs2.B

.jar file will not open on my Mac

This question already has an answer here: What does “Could not find or load main class” mean? 39 answers Inside the jar, there should be a file: META-INFMANIFEST.MF Inside this text file, you should have at least: Main-Class: net.minecraft.client.Main and make sure you have this inside the jar: net-. | minecraft-. | client-. |

.jar文件无法在我的Mac上打开

这个问题在这里已经有了答案: “无法找到或加载主类”是什么意思? 39个答案 在jar里面,应该有一个文件: META-INFMANIFEST.MF 在这个文本文件中,你至少应该有: Main-Class: net.minecraft.client.Main 并确保你在罐子里有这个: net-. | minecraft-. | client-. | Main.class 任何额外的罐子都应该与显示元素Class-Path一起列出。

compare two strings in java using command line arguments

This question already has an answer here: What does “Could not find or load main class” mean? 39 answers "Error: Could not find or load main class CompareString" Your error message says you couldn't load class "CompareString", but your code says your class name is CompareString s . Your class name is wrong. Your error says Error: Could not find or load main cl

使用命令行参数比较java中的两个字符串

这个问题在这里已经有了答案: “无法找到或加载主类”是什么意思? 39个答案 “错误:无法找到或加载主类CompareString” 你的错误信息说你无法加载类“CompareString”,但你的代码说你的类名CompareString 秒 。 你的课堂名称是错误的。 你的错误说 错误:无法找到或加载主类CompareString 但类的名称是CompareStrings而不是CompareString 使用java CompareStrings启动 阅读这个编译和启动java程序的好教程 首

Junit inline comparator initialization error

I've created a SortedList Class, which has a Constructor that takes a java.util.Comparator as an argument. After running Unit tests on my machine (through eclipse 3.3.0), everything was OK. However, Hudson complaints because it says it can't instantiate my comparator. Here its my simple test (snippets) public class SortedListTest { class strcmp implements Comparator<String&g

Junit内联比较器初始化错误

我创建了一个SortedList类,它有一个将java.util.Comparator作为参数的构造函数。 在我的机器上运行单元测试(通过eclipse 3.3.0)后,一切正常。 然而,哈德逊的投诉,因为它说它不能实例化我的比较。 在这里,我的简单测试(片段) public class SortedListTest { class strcmp implements Comparator<String>{ public strcmp(){} public int compare(String s1,String s2){ ret

How to determine the maximum stack size limit?

I want to determine the maximum size of the stack programmatically from within Java (the size set by -Xss). How do I do this? Alternatively, as my Java module also uses a native code module, I would be able to do this via JNI; but how? 使用ManagementFactory.getRuntimeMXBean().getInputArguments()来访问传递给VM的所有参数。 也许不是最佳实践,但肯定是直截了当的:我会写一个递归方法计算一个值,直

如何确定最大堆栈大小限制?

我想从Java内部以编程方式确定堆栈的最大大小(由-Xss设置的大小)。 我该怎么做呢? 或者,因为我的Java模块也使用本地代码模块,所以我可以通过JNI来完成此操作; 但是如何? 使用ManagementFactory.getRuntimeMXBean().getInputArguments()来访问传递给VM的所有参数。 也许不是最佳实践,但肯定是直截了当的:我会写一个递归方法计算一个值,直到java.lang.StackOverflowError重复并查看计数器。 public class Test { sta

How to install the JDK on Ubuntu Linux

I am trying to install the Java Development Kit (JDK) on Ubuntu Linux distribution, but I am unable to install it. What are the steps to install it on Ubuntu? Referring to Ask Ubuntu question How to set JAVA_HOME for OpenJDK?, How to install "Open JDK" (Java developement kit) in Ubuntu (Linux)? Open Terminal from Application Dash or press Ctrl+Alt+T Update repository: sudo ad

如何在Ubuntu Linux上安装JDK

我试图在Ubuntu Linux发行版上安装Java Development Kit(JDK),但我无法安装它。 在Ubuntu上安装它的步骤是什么? 参考Ask Ubuntu问题如何为OpenJDK设置JAVA_HOME ?, 如何在Ubuntu(Linux)中安装“Open JDK”(Java开发工具包)? 从应用程序破折号打开终端或按Ctrl + Alt + T 更新存储库: sudo add-apt-repository ppa:openjdk-r/ppa sudo apt-get update 在终端中运行以下命令: sudo apt-get install openjdk-8

platform Java method to remove filename special chars?

I'm making a cross-platform application that renames files based on data retrieved online. I'd like to sanitize the Strings I took from a web API for the current platform. I know that different platforms have different file-name requirements, so I was wondering if there's a cross-platform way to do this? Edit: On Windows platforms you cannot have a question mark '?' in a

平台Java方法来删除文件名特殊字符?

我正在制作一个跨平台的应用程序,根据在线检索的数据重命名文件。 我想清理从当前平台的Web API中获取的字符串。 我知道不同平台有不同的文件名要求,所以我想知道是否有跨平台的方式来做到这一点? 编辑:在Windows平台上,你不能有问号'?' 在文件名中,而在Linux中,您可以。 文件名可能包含这些字符,我希望支持这些字符的平台保留它们,否则将它们除去。 另外,我更喜欢不需要第三方库的标准Java解决方案

Adding aggregate function to external H2 database

I'm trying to create an aggregate function in my H2 database using Java. The function should return a custom median calculation from the given Double column. This calculation consist in using only the values that are close enough to the average value using the max_variance int value. For this I created the class: package custommedian; public class CustomMedian implements org.h2.api.Aggre

将聚合函数添加到外部H2数据库

我试图在我的H2数据库中使用Java创建一个聚合函数。 该函数应该从给定的Double列返回一个自定义的中值计算。 此计算仅包含使用max_variance int值的平均值足够接近的值。 为此我创建了这个类: package custommedian; public class CustomMedian implements org.h2.api.AggregateFunction{ final int max_variance = 7; java.util.LinkedList<Double> values = new java.util.LinkedList<Double>();

LBYL vs EAFP in Java?

I was recently teaching myself Python and discovered the LBYL/EAFP idioms with regards to error checking before code execution. In Python, it seems the accepted style is EAFP, and it seems to work well with the language. LBYL ( L ook B efore Y ou L eap): def safe_divide_1(x, y): if y == 0: print "Divide-by-0 attempt detected" return None else: return x/y EAFP

在Java中LBYL vs EAFP?

我最近在教自己的Python,并在代码执行之前发现了LBYL / EAFP成语,用于错误检查。 在Python中,EAFP似乎是可以接受的风格,并且它似乎与该语言一致。 LBYL(L OOK 乙安伏Ÿ欧大号 EAP): def safe_divide_1(x, y): if y == 0: print "Divide-by-0 attempt detected" return None else: return x/y EAFP(IT公司的E asier到一个 SK˚Forgiveness除P ermission): def safe_divide_2(x, y):

Why is it bad practice to call System.gc()?

After answering a question about how to force-free objects in Java (the guy was clearing a 1.5GB HashMap) with System.gc() , I was told it's bad practice to call System.gc() manually, but the comments were not entirely convincing. In addition, no one seemed to dare to upvote, nor downvote my answer. I was told there that it's bad practice, but then I was also told that garbage collecto

为什么调用System.gc()是不好的做法?

在回答了关于如何使用System.gc()清除Java中强制释放对象的问题(这个人正在清除1.5GB HashMap System.gc() ,我被告知手动调用System.gc()是一种不好的做法,但是这些注释并不是完全有说服力。 另外,似乎没有人敢鼓掌,也没有倒下我的答案。 当时有人告诉我这是一种不好的做法,但后来我被告知垃圾收集器的运行不再系统地阻止世界,它也可以被JVM有效地用作提示,所以我有点在损失。 我明白,当需要回收内存时,JVM通常比