cmd command
java HelloWorld
Can not find or load main class HelloWorld
java-passclass HelloWorld
Unrecognize option:-passclass HelloWorld
error: could not creat the Java Virtual Machine
here exclude the alphabet , I is NETBEANS series, compiles and runs without problems
environment configuration :
CLASSPATH:.;% JAVA_HOME% \ lib;% JAVA_HOME% \ lib \ dt.jar;% JAVA_HOME% \ lib \ tools.jar
JAVA_HOME: D: \ java jdk1.7.3
Path:% JAVA_HOME% \ bin;% JAVA_HOME% \ jre \ bin
After the test no problem ah ! ! !
compiled files with NETBEANS is on the E drive , tangled for a long time , did not understand ! ! Pursuing big God
------ Solution ------------------------------------- -------
compile time java HelloWord.java
Since you should be compiled to run javac HelloWord
------ Solution ---------------------- ----------------------
If you want to compile the file . java files . To set up your computer and then show the suffix .
------ Solution ---------------------------------------- ----
still have problems ah classpath set your location HelloWorld.class not give ah
------ Solution ------------------------------------ --------
do not put jdk installed in directories with spaces
------ Solution -------------------- ------------------------
directory is best not to have spaces , especially in a variety of professional software , the best independent build a specialized storage folders , otherwise there may be unexpected problems .
landlord of the problem I was reloaded into a directory without spaces resolved
------ Solution ---------------------- ----------------------
% JAVA_HOME% \ lib \ dt.jar; into
;% JAVA_HOME% \ lib \ rt.jar;.;
try. . .
------ Solution ---------------------------------------- ----
program has MAIN function do ?
------ Solution ------------------------------------ --------
put your source code stickers, real name HelloWorld class do ? I 'm learning , but also committed such a mistake Caesar
------ Solution ------------------------------------ --------
first cut to the package name compile and run
------ Solution -------------------- ------------------------
which were entered in the cmd java, javac see if there is not a lot of things out , yes , that you the configuration is successful, you configure the best route to go copy
------ Solution --------------------------- -----------------
cmd
E: \ java \ HelloWorld \ src \ helloworld> javac HelloWorld.java
E: \ java \ HelloWorld \ src \ helloworld> java HelloWorld
fainted ! ! !
changed :
cmd
E: \ java \ HelloWorld \ src> javac-d. helloworld / HelloWorld.java
E: \ java \ HelloWorld \ src> java helloworld.HelloWorld
------ For reference only -------------------- -------------------
tried it , still the same problem
------ For reference only -------- -------------------------------
amount , sorry remember it
above reply was wrong , you just java E :/ / HelloWorld
Try it
------ For reference only ------------------------------- --------
the same ah. . . To the point of principle it
------ For reference only ---------------------------------- -----
still the same, the internet has , ah, tried, useless
------ For reference only ---------------- -----------------------
E: \ java \ HelloWorld \ src \ helloworld> java HelloWorld
Exception in the thread "main" java.lang.NoClassDeFoundError: HelloWorld
------ For reference only ------ ---------------------------------
my program are placed in E: \ java inside,
Then I set this right classpath : CLASSPATH:.;% JAVA_HOME% \ lib;% JAVA_HOME% \ lib \ dt.jar;% JAVA_HOME% \ lib \ tools.jar; E: \ java
this way re- tried again
E: \> java HelloWorld
java HelloWorld
Can not find or load main class HelloWorld
E: \> java-passclass HelloWorld
Unrecognize option:-passclass HelloWorld
error: could not creat the Java Virtual Machine
------ For reference only ---------------------------------- -----
directory can not contain spaces. . . That I have to re- install or directly change directory ah. . Is this you ? Others directories with spaces can
------ For reference only -------------------------------- -------
miserable . . . . Reloading . . . Works great ah. . .
------ For reference only -------------------------------------- -
14 floor of my dear friend . . . . Not ah
Exception in the thread "main" java.lang.NoClassDeFoundError: HelloWorld
Today reload
------ For reference only ---------------------------------- -----
re-installed
path into D: \ java \ jdk1.7.3
JAVA_HOME: D: \ java \ jdk1.7.3
environment variable settings test is successful, you can display the version 1.73
E: \> javac HelloWorld.java no problem
E: \> java HelloWorld on error
Exception in the thread "main" java.lang.NoClassDeFoundError: HelloWorld
challenge patience ah. . . .
------ For reference only -------------------------------------- -
/ *
* To change this template, choose Tools | Templates
* and open the template in the editor.
* /
package helloworld;
/ **
*
* @ author Administrator
* /
public class HelloWorld {
/ **
* @ param args the command line arguments
* /
public static void main (String [] args) {
System.out.println ("HelloWorld");
}
}
------ For reference only ---------------------------------- -----
it in the package , using NETBEANS run a successful
cmd
E: \ java \ HelloWorld \ src \ helloworld> javac HelloWorld.java
E: \ java \ HelloWorld \ src \ helloworld> java HelloWorld
Exception in the thread "main" java.lang.NoClassDeFoundError: HelloWorld
........
------ For reference only -------------------------- -------------
even versions are out. Dude
------ For reference only ------------------------------------- -
24 Floor, Department of positive Solutions ah. . . . What does this have to learn ? dos operating system ? Thank you ! ! !
------ For reference only -------------------------------------- -
-d. Why do we need this, it
------ For reference only ----------------------- ----------------
your answer to the question should be in here
http://blog.jrj.com.cn/2797406448, 5365872a.html
------ For reference only ----------------- ----------------------
Note : CLASSPATH values finally did ; ( semicolon ) the following error occurs
Error: Can not find or load main class HelloWorld.
engage in an afternoon, that is the problem. . . .
------ For reference only -------------------------------------- -
I encounter is the 28 # issue mentioned in the CLASSPATH semicolon followed by a later , there is no problem.
------ For reference only -------------------------------------- -
28 House said it right , I tried
------ For reference only -------------------- -------------------
less a semicolon Why not?
------ For reference only -------------------------------------- -
If you add a system variable classpath ; semicolon or not words. Another reason is that there less variable in the user classpath variable .
Users only need to create a classpath variable on the same variables on the system classpath variable value is copied to the user on the classpath variable can be friends .
------ For reference only -------------------------------------- -
If you add a system variable classpath ; semicolon or not words. Another reason is that there less variable in the user classpath variable .
Users only need to create a classpath variable on the same variables on the system classpath variable value is copied to the user on the classpath variable can be friends .
------ For reference only -------------------------------------- -
28 F, positive solution, which if it does not know how to engage in nor wow
------ For reference only -------------------- -------------------
I was so
with class suffix not, but OK without
------ For reference only ------------------------- --------------
this problem that white is the format of java compiler command :
javac e: \ Example.java / / Here javac command to compile the class file , followed by the java file 's full name, including the directory and file name.
cd e: \
java Example / / Here java class files to run the command , followed by the main class name , which is the main function of the class containing the name of the class name and the file name to unity .
------ For reference only ---------------------------------- -----
not find the class, explain the problem lies in the classpath. As long as the command line, enter : set classpath =% classpath%;.
add the current path ( one point ) to the classpath on ok.
------ For reference only --------------------- ------------------
37 Floor practical.
没有评论:
发表评论