コマンド ラインからコードを実行しようとすると、次の例外エラーが発生します。
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 内から実行すると、正常に動作しますか?
どんな助けでも大歓迎です!
ありがとう