Create HelloWorld Program
To get started writing your first simple program, open a command window. Make sure your PATH variable includes a path to the ...\bin directory of the Ja.NET SE JDK installation. Once that's done, open your favorite text editor. Copy and paste the code below into it. Save it to a file with the name, MyProgram.java.
class HelloWorld {
public static void saySomethingUsingJava(String message) {
System.out.println(message);
}
public static void saySomethingUsingDotNet(String message) {
System.Console.WriteLine(message);
}
}
public class MyProgram {
public static void main(String[] args) {
HelloWorld.saySomethingUsingJava("A message via Java API's");
HelloWorld.saySomethingUsingDotNet("A message via .NET framework API's");
}
}
Compile and Run on .NET
Next, compile the MyProgram.java file using the Ja.NET SE javac compiler. You can do this just as you would using any other standard Java JDK; simply enter 'javac MyProgram.java' at the command line. Now, to run the resulting program on .NET, you simply use the Ja.NET SE launcher (i.e., java) to start the application. Enter 'java MyProgram' at the command prompt. You should see it print the expected output in the console window.
C:\>javac MyProgram.java
C:\>java MyProgram
A message via Java API's
A message via .NET framework API's
C:\>
Next, let's look at the example in more detail so we can figure out what's actually going on under the hood!