launching hello world

David Holmes david.holmes at oracle.com
Fri Dec 4 07:03:01 UTC 2015


Hi,

On 4/12/2015 2:40 AM, Papá wrote:
> I am not sure if this is the mailing list I should be posting in this question, but to the lack of java-newbie mailing list this was my first choice.

OpenJDK mailing lists are about developing the software for the OpenJDK 
platform, not about how to write Java programs - hence no java-newbie 
lists. There are many such newbie resources elsewhere, which a simple 
google search will reveal. The answer to your specific question will 
also be in the Eclipse documentation - as it can execute the code you 
are creating. Java is a language that is executed by a virtual machine 
which initially interprets the bytecode of your Java program, and can 
also compile it to native code dynamically while running. The executable 
you run is the java launcher (eg java.exe), passing it the name of your 
main application class.

Cheers,
David

> Using Eclipse Java Mars.1, I wrote a programs that displays the world “Hi!” that looks like this:
> ------------
> package ca.arbolone.jme;
>
> public class Person {
> 	private String name;
> 	
> 	Person(){
> 		name = "Hi!";
> 		}
> 	public String getName(){ return name; }
> }
> --------------
> package ca.arbolone.jme;
> import java.util.Scanner;
>
> public class TotalBegginer {
>
> 	public static void main(String[] args) {
> 		// TODO Auto-generated method stub
> 		Scanner keyboard = new Scanner(System.in);
> 		Person person = new Person();
> 		System.out.println( person.getName() );
> 		keyboard.nextLine();
>
> 	}
>
> }
>
> Which creates the following directories
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> d-----       2015-12-02   5:40 AM                .settings
> d-----       2015-12-02   5:42 AM                bin
> d-----       2015-12-02   5:42 AM                src
> -a----       2015-12-02   5:40 AM            301 .classpath
> -a----       2015-12-02   5:40 AM            389 .project
>               2015-12-03  11:34 AM              0 TotalBegginer.txt
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\.settings
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> -a----       2015-12-02   5:40 AM            598 org.eclipse.jdt.core.prefs
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\bin
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> d-----       2015-12-02   5:42 AM                ca
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\bin\ca
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> d-----       2015-12-02   5:42 AM                arbolone
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\bin\ca\arbolone
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> d-----       2015-12-02   6:47 AM                jme
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\bin\ca\arbolone\jme
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> -a----       2015-12-02   7:34 PM            441 Person.class
> -a----       2015-12-02   7:34 PM            880 TotalBegginer.class
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\src
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> d-----       2015-12-02   5:42 AM                ca
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\src\ca
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> d-----       2015-12-02   5:42 AM                arbolone
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\src\ca\arbolone
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> d-----       2015-12-02   6:47 AM                jme
>
>
>      Directory: C:\Users\Del\Documents\Eclipse\TotalBegginer\src\ca\arbolone\jme
>
>
> Mode                LastWriteTime         Length Name
> ----                -------------         ------ ----
> -a----       2015-12-02   7:34 PM            159 Person.java
> -a----       2015-12-02   7:34 PM            325 TotalBegginer.java
>
>
> There is nothing here with the extension “.exe”; coming from the C/C++ world I wonder,
> How do I dun my program by clicking on it?
>
> Please help me understand, do I have to write a batch file or create an executable in C?
> Sent from Mail for Windows 10
>


More information about the jdk9-dev mailing list