2016-04-09 12 views
0

için ana sınıf yüklenemedi: https://docs.oracle.com/javase/tutorial/getStarted/intro/index.htmlHata: bulmak ya da burada birlikte takip çalışılıyor javactır

Java adım 1. yapmak büyülü sözleri alınamıyor.

CLASSPATH dışa aktarmayı denedim =. ve ihracat CLASSPATH = ama henüz bir sınıf dosyası bile yok.

Birisi doğru yönde işaret edebilir. Zaten temel yazıların çoğunu denedim.

$uname -a 
Linux box 3.19.0-41-generiC#46-Ubuntu SMP Fri Dec 4 18:18:11 UTC  2015 x86_64 x86_64 x86_64 GNU/Linux 

$ javac -version 
java version "1.8.0_77" 
Java(TM) SE Runtime Environment (build 1.8.0_77-b03) 
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) 

$javac ./hello.java 
Error: Could not find or load main class ..hello.java 
$javac ./hello 
Error: Could not find or load main class ..hello 
$javac hello.java 
Error: Could not find or load main class hello.java 
$javac hello 
Error: Could not find or load main class hello 
$javac -cp . hello 
Error: Could not find or load main class hello 
$javac -d . hello 
Unrecognized option: -d 
Error: Could not create the Java Virtual Machine. 
Error: A fatal exception has occurred. Program will exit. 
$java -version 
java version "1.8.0_77" 
Java(TM) SE Runtime Environment (build 1.8.0_77-b03) 
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) 

$ cat hello.java 
public class hello 

{ 
    public static void main(String[] args) 
    { 
     System.out.println("Hello World!"); 
    } 
} 
+1

derlemek için: çalıştırmak için '' '$ javac hello.java''':' '' $ java hello''' –

+4

sizin 'javac'' java' çağırmak gibi görünüyor. Hangi javac'ın çıkışı nedir? – wero

+1

Belki bu yardımcı olabilir http://stackoverflow.com/questions/17388287/java-running-a-program-at-command-prompt-could-not-find-or-load-main-class –

cevap

0

Not: javac java'ya bağlandı.

Çözüm:

rm /etc/alternatives/javac 
ln -s /usr/local/java/jdk1.8.0_77/bin/javac /etc/alternatives/javac 
İlgili konular