리눅스 서버에 프로그램을로드하는 데 문제가 있습니다. 내가 사용하고있는 IDE에서 내 코드를 복사하여 복사 할 수 있었고 서버가 컴파일되고 실행되도록하고 실행을 비 웠습니다. 나는 println 줄을 printf로 바꿨고 파일이 컴파일되지 않고 매번 "주 클래스 Program01을 찾거나로드 할 수 없습니다"라는 오류 메시지가 나타납니다. 방금 작동했던 예전 코드를 붙여 넣을 때를 포함하여, 노력하고있는 모든 것이 실패하고 있습니다. 제가 고칠 수있는 것에 대한 다른 의견을 찾고 있습니다. "312032486"번호의 입력 파일에서 가져옵니다. 메인 클래스를 찾거나로드 할 수없는 이유가 궁금합니다. 나는 다른 모든 것이 의도 한대로 작동하고 있다고 생각합니다.자바 파일 오류 : 메인 클래스를 찾지 못했습니다.
내가 자바를 처음 사용하는 사람들을 보면서 모든 기기를 열어 줘서 고마워. 코멘트에있는 당신의 발언 후
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package program01;
import java.util.Scanner;
/**
*
* @author Devin
*/
public class Program01 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// Create variables for birth rate, death rate and immigration raet
int birthRate = 1/7;
int deathRate = 1/13;
int immigrationRate = 1/45;
// Variable creating the number of seconds per year
int secondsPerYear = 60 * 60 * 24 * 365;
// Variable to find births, deaths and immigrants added per year
int birthsPerYear = birthRate * secondsPerYear;
int deathsPerYear = deathRate * secondsPerYear;
int immigrantsPerYear = immigrationRate * secondsPerYear;
// Scanner method to GET population through input.data
Scanner sc = new Scanner (System.in);
System.out.printf("Enter population: ");
int population = sc.nextInt();
System.out.printf("Population is: " + population);
// Math to create variables for population per X year
double populationYear0 = population;
double populationYear1 = populationYear0 + birthsPerYear - deathsPerYear + immigrantsPerYear;
double populationYear2 = populationYear1 + birthsPerYear - deathsPerYear + immigrantsPerYear;
double populationYear3 = populationYear2 + birthsPerYear - deathsPerYear + immigrantsPerYear;
double populationYear4 = populationYear3 + birthsPerYear - deathsPerYear + immigrantsPerYear;
double populationYear5 = populationYear4 + birthsPerYear - deathsPerYear + immigrantsPerYear;
// Print out the variables data from code above
System.out.println("Population Year 0: " + populationYear0);
System.out.println("Population Year 1: " + populationYear1);
System.out.println("Population Year 2: " + populationYear2);
System.out.println("Population Year 3: " + populationYear3);
System.out.println("Population Year 4: " + populationYear4);
System.out.println("Population Year 5: " + populationYear5);
}
}
실행에 사용중인 명령은 무엇입니까? – Amita
내 학교의 Linux 서버를 사용하여 SubmitJ라는 명령을 사용합니다. 그렇다면 그것은 내가 메인 클래스를 선택 하고이 프로그램을 선택하면 Program01 내게 오류가 발생합니다. 내 다른 2 개의 메인 클래스 프로그램은 잘 작동합니다. – Devin
패키지도 있습니까? 'jar' 또는'class'es로 컴파일합니까? 서버는 온라인 판사를 의미합니까? – xenteros