Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Nemam konzolu kad koristim IDE: i Eclipse i IntelliJIdea? i Console klasu

[es] :: Java :: Nemam konzolu kad koristim IDE: i Eclipse i IntelliJIdea? i Console klasu

[ Pregleda: 2282 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

tep3a
Milan Terzic
Nis,Srbija,Supak kosmosa

Član broj: 24966
Poruke: 64
77.46.225.*

Sajt: www.terza.info


Profil

icon Nemam konzolu kad koristim IDE: i Eclipse i IntelliJIdea? i Console klasu04.11.2007. u 19:42 - pre 201 meseci
daklem,

ovaj kod:

Code:

package info.terza.sistemski;

import java.io.Console;

public class ConsoleTest {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        try {
            Console con = System.console();
            if (con == null) {
                System.out.println("Nema konzole??");
            }
            
            String unos = con.readLine("Unesite neku rec: ");
            System.out.println("Sa konzole je uneseno: "+ unos);
            
            
        } catch (Exception e) {
            // TODO: handle exception
        }
        
    }

}



baca exception i ispise "Nema konzole??" bilo pod Eclipse-tom ili IntelliJidea.

Verzija Jave je 1.6.0 u3 i kada ovaj kod kompajliram i poteram iz konzole, radi sasvim ok!

U cemu je fora? Da li postoji nacin da podesim ova okruzenja da imam punu konzolu u njima?

Unapred hvala!
signature error
 
Odgovor na temu

bags

Član broj: 10072
Poruke: 715
*.12.15.tuwien.teleweb.at.



+2 Profil

icon Re: Nemam konzolu kad koristim IDE: i Eclipse i IntelliJIdea? i Console klasu04.11.2007. u 23:23 - pre 201 meseci
Koristi umejsto Console: new Scanner( System.in ) .

Objasnjenje sa http://java.sun.com/javase/6/docs/api/java/io/Console.html :

Citat:

Whether a virtual machine has a console is dependent upon the underlying platform and also upon the manner in which the virtual machine is invoked. If the virtual machine is started from an interactive command line without redirecting the standard input and output streams then its console will exist and will typically be connected to the keyboard and display from which the virtual machine was launched. If the virtual machine is started automatically, for example by a background job scheduler, then it will typically not have a console.


Free advice is seldom cheap.
 
Odgovor na temu

[es] :: Java :: Nemam konzolu kad koristim IDE: i Eclipse i IntelliJIdea? i Console klasu

[ Pregleda: 2282 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.