This is how to compile a Java source file on Linux with gcj.
homer@neo:~/Documents$ gcj --main=HelloWorld HelloWorld.java |
homer@neo:~/Documents$ gcj --main=HelloWorld HelloWorld.java
This is the source file that I am working with.
/*
* My first Java program.
*
*/
import java.util.Date;
public class HelloWorld {
public static void main(String[] args) {
System.out.printf("\"Hello, World\"\n");
Date date = new Date();
System.out.println("The date is: " + date.toString() + ".");
}
} |
/*
* My first Java program.
*
*/
import java.util.Date;
public class HelloWorld {
public static void main(String[] args) {
System.out.printf("\"Hello, World\"\n");
Date date = new Date();
System.out.println("The date is: " + date.toString() + ".");
}
}
And after I have compiled the program, I can run it by typing ./a.out and I will see the output.
homer@neo:~/Documents$ ./a.out
"Hello, World"
The date is: Sat Aug 10 00:16:15 AEST 2013. |
homer@neo:~/Documents$ ./a.out
"Hello, World"
The date is: Sat Aug 10 00:16:15 AEST 2013.
And this is how to install the gcj Java compiler on Debian 7.0.
sudo apt-get install gcj-4.6-jre |
sudo apt-get install gcj-4.6-jre
homer@neo:~$ sudo apt-get install gcj-4.6-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcj-4.6-jre is already the newest version.
The following packages were automatically installed and are no longer required:
libossp-uuid16 libpq5 postgresql-client-common postgresql-common timelimit
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 118 not upgraded. |
homer@neo:~$ sudo apt-get install gcj-4.6-jre
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcj-4.6-jre is already the newest version.
The following packages were automatically installed and are no longer required:
libossp-uuid16 libpq5 postgresql-client-common postgresql-common timelimit
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 118 not upgraded.