Home > Back-end >  Refer to the Java class files on the server can't run
Refer to the Java class files on the server can't run

Time:12-07

I JDK has been installed on the server, but you can't run my class file, the following error

My Java code is as follows:
 package cn. Itcast. Day08. Demo01; 
Public class demo {
Public static void main (String [] args) {
Int num=1;
While (true) {
Try {
System. The out. Println (" this is the first "+ num +" print ");
Num + +;
Thread.sleep(1000);
} the catch (Exception e) {
continue;
}
}
}
}

CodePudding user response:


My computer's JDK version

I cloud server JDK version

CodePudding user response:

reference 1st floor MuSa xiaoxiang reply:

My computer's JDK version

I cloud server JDK version

Compile time, want to specify the target version
Javac demo. Java -- target 8

CodePudding user response:

refer to the second floor icoolno1 response:
Quote: refer to 1st floor MuSa xiaoxiang reply:

My computer's JDK version

I cloud server JDK version

Compile time, want to specify the target version
Javac demo. Java -- target 8

I is the IDEA to run automatically generated, no way to specify version ah, don't transfer to the server each time need in CMD to perform a compilation? The Java is too cumbersome

CodePudding user response:

reference MuSa xiaoxiang reply: 3/f
Quote: refer to the second floor icoolno1 response:
Quote: refer to 1st floor MuSa xiaoxiang reply:

My computer's JDK version

I cloud server JDK version

Compile time, want to specify the target version
Javac demo. Java -- target 8

I is the IDEA to run automatically generated, no way to specify version ah, don't transfer to the server each time need in CMD to perform a compilation? The Java is too cumbersome

In the IDEA also can set the

CodePudding user response:

The backslash '/' to 'try, Java followed is the name of the class, not a file path,

CodePudding user response:

refer to fifth floor ice rain reply:
the backslash '/' to '. 'try and Java followed is the name of the class, not a file path,

Or I can't
 [root @ VM - 0 to 14 - centos demo01] # Java cn. Itcast. Day08. Demo01. Demo 
Error: Could not find the or the load the main class. Cn itcast. Day08. Demo01. Demo

CodePudding user response:

reference 4 floor icoolno1 response:
Quote: refer to the third floor MuSa xiaoxiang reply:
Quote: refer to the second floor icoolno1 response:
Quote: reference 1st floor MuSa xiaoxiang reply:

My computer's JDK version

I cloud server JDK version

Compile time, want to specify the target version
Javac demo. Java -- target 8

I is the IDEA to run automatically generated, no way to specify version ah, don't transfer to the server each time need in CMD to perform a compilation? The Java is too cumbersome

In the IDEA also can set the

It redone my IEDA can't run, prompt java9 need to specify the Java version

CodePudding user response:

According to your great god methods are tried, but still won't do, don't know where is wrong, I just started to learn Java, don't remove the inside of the doorway, leave a message please know... Thank you for the

CodePudding user response:

This is to choose 8
  • Related