0
I don t know how to run a code into a cmd because it handels a window can you help me?
the code isn t have any bug is the cmd that can t handled it and i don t know if is not supported by my compiling javac xxxx.java
7 Antworten
+ 7
Did you set the path variable in your system environment after installing jdk?
https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
+ 1
This is the code
package Juego;
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Dimension;
import javax.swing.JFrame;
public class Juego extends Canvas{
private static final long serialVersionUID = 1L;
private static final int ANCHO = 800;
private static final int ALTO = 600;
private static final String NOMBRE = "Juego";
private static JFrame ventana;
private Juego(){
setPreferredSize(new Dimension(ANCHO, ALTO));
ventana = new JFrame(NOMBRE);
ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ventana.setResizable(false);
ventana.setLayout(new BorderLayout());
ventana.add(this, BorderLayout.CENTER);
ventana.pack();
ventana.setLocationRelativeTo(null);
ventana.setVisible(true);
}
public static void main(String[] args){
Juego juego = new Juego();
}
}
0
yes and the function javac works
0
yes i compiled everything
0
and executed but didn t work
0
1-you have just to run the cmd window (Windows+R(cmd))
2-type : dir and click enter
if your program or file java in the desktop, you should type : cd desktop
then click enter
3- type javac yourfilename.java and click enter
4- type java yourfilename (without .java) and click enter
you will see your println