title: How to compile Java to Native using GraalVM (SubstrateVM) in Eclipse
body: <p>I have a research project (implemented in in Java 8) will several classes, several main functions and well over 10000 lines of code, in Eclipse. The program runs out of memory when the input is not small.</p>
  
  <p>I wanted to see if it will use less Stack memory, if compiled as a native application.</p>
  
  <p>I have found no way to do this in Eclipse.</p>
  
  <p>I did<br>
  <code>$GRAALVM_HOME/bin/javac /home/appu/Downloads/2019/June/20/HelloWorld.java</code>
  <br>It worked. I got a working binary.</p>
  
  <p>I tried<br>
  <code>/home/appu/Downloads/Apps/GraalVM/2019-06-20/graalvm-ee-19.0.2/bin/native-image /home/appu/eclipse-nimi/NimishaGraalEE19/bin/nimi/decimate/Decimate.class</code>
  <br>I got <code>Main entry point class '/home/appu/eclipse-nimi/NimishaGraalEE19/bin/nimi/decimate/Decimate.class' not found.</code></p>
  
  <p>I tried<br>
  <code>/home/appu/Downloads/Apps/GraalVM/2019-06-20/graalvm-ee-19.0.2/bin/native-image /home/appu/eclipse-nimi/NimishaGraalEE19/bin/*</code>
  <br>I got <code>Main entry point class '/home/appu/eclipse-nimi/NimishaGraalEE19/bin/nimi' not found.</code></p>
  
  <p>The classic</p>
  
  <pre><code>public class HelloWorld
  {
      public static void main(String[] args)
      {
          System.out.println("Hello, World!");
      }
  }
  </code></pre>
  
  <p>is compiled into "HelloWorld.class"</p>
  
  <p>which gives an executable "helloworld" which is executable (application/x-executable).</p>
  
  <p>Can I have the same, from Eclipse? Can I have the same from command line, for multiclass files?</p>
  
  <p>When I change the above code into</p>
  
  <pre><code>public class HelloWorld
  {
      public static void hello()
      {
          System.out.println("Hello, World!");
      }
  }
  </code></pre>
  
  <p>and add another class</p>
  
  <pre><code>public class Main
  {
      public static void main(String[] args)
      {
          HelloWorld.hello();
      }
  }
  </code></pre>
  
  <p>They compile correctly, but I get</p>
  
  <pre><code>appu[23]/home/appu/Downloads/Apps/GraalVM/2019-06-20/graalvm-ee-19.0.2/bin/native-image /home/appu/Downloads/2019/June/23/HelloWorld.class 
  Build on Server(pid: 17223, port: 36631)                                                          
  [/home/appu/downloads/2019/june/23/helloworld.class:17223]    classlist:     415.66 ms            
  Error: Main entry point class '/home/appu/Downloads/2019/June/23/HelloWorld.class' not found.     
  Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception             
  Error: Image build request failed with exit status 1                                              
  appu[23]ls                                                                                        
  HelloWorld.class  HelloWorld.java  Main.class  Main.java
  </code></pre>
  
  <p>What I want is an executable (in my case, a Gnu/Linux executable) file which can be used as a native executable.</p>
  
  <p>I prefer a solution from Eclipse, but Command line, Netbeans, VS Code, ... or any other technique is welcome.</p>
  
  <hr>
  
  <p>In response to answer by BoriS:</p>
  
  <p>I tried making a jar a few hours ago, and made a file called Main. It did not work.</p>
  
  <pre><code>jar cfe Main.jar Main Main.class
  /home/appu/Downloads/Apps/GraalVM/2019-06-20/graalvm-ee-19.0.2/bin/native-image -jar /home/appu/Downloads/2019/June/23/Main.jar
  ./Main
  </code></pre>
  
  <p>When I ran Main which is executable (application/x-executable) type, I Got</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
          at Main.main(Main.java:5)
  Caused by: java.lang.ClassNotFoundException: HelloWorld
          at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 1 more
  </code></pre>