当我尝试从命令行运行我的代码时,我收到以下异常错误;
X:\User temp\httpclient>java httpclient_main 10 10
Exception in thread "main" java.lang.NoClassDefFoundError: httpclient_main (wron
g name: httpclient/httpclient_main)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
httpclient_main.java;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package httpclient;
import java.io.DataInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
/**
*
* @author tsothcott
*/
public class httpclient_main {
protected String host;
protected String file;
protected int port;
protected DataInputStream in;
protected DataOutputStream out;
static double threadResult;
String get_file()
{
return this.file;
}
DataOutputStream get_outputstream() {
return this.out;
}
public static void main(String[] args) throws IOException {
InputTxt servers = new InputTxt();
threadResult = 0.0D;
SharedCell cell = new SharedCell();
if(args.length <1)
throw new IOException("Usage: HTTPClient URL Number_Thread");
int num_thread = Integer.parseInt(args[0]);
int count_interval = Integer.parseInt(args[1]);
servers.printservers();
Manufacture prod = new Manufacture(cell, num_thread, count_interval);
prod.start();
}
}
项目结构截图;
但是,当我从 NetBeans 内部运行它时,它运行良好吗?
任何帮助,将不胜感激!
谢谢