how to compile & run the gedit 'xyz.java' after installing java?

Asked by Asif ansari

Hi sir, i have installed java runtime 7 via software center.After which i am stuck..how should i compile any of the text gedit file xyz.java and run it and the output?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu openjdk-7 Edit question
Assignee:
No assignee Edit question
Solved by:
Asif ansari
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Try:

java xyz.java

Revision history for this message
samuel (samuel-h) said :
#2

If it is a .java file editable in gedit you will have to compile it first, for this use javac xyz.java, if javac doesn't work install the JDK. Then to execute it navigate using cd to the location the .class file genearated by javac xyz.java and type java xyz (the .class is not nesscary, however you must be in the location of the file), this will execute the program. If you are planning to develop java I would reccomend downloading eclipse or netbeans from the software center, as these provide syntax highlighting and will compile and run the program at the push of a button.

Revision history for this message
Asif ansari (asif-ansari4u) said :
#3

asif@asif-desktop:/media/Softwares$ java QueueTest.java
Error: Could not find or load main class QueueTest.java

Revision history for this message
Asif ansari (asif-ansari4u) said :
#4

though the program is compiled it is not running

Revision history for this message
Asif ansari (asif-ansari4u) said :
#5

Thanks it helped......thanx alot