English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

After creating Java source code in notepad and save it as "filename.java" and compile it, Im wondering if I can convert my java file to executable file the way Its done like in pascal etc...

2007-10-28 20:50:03 · 5 answers · asked by bongalvarez2004 1 in Computers & Internet Programming & Design

5 answers

What you need to do is create a jar file.
http://java.sun.com/javase/6/docs/technotes/tools/windows/jar.html

Here is the tutorial
http://java.sun.com/docs/books/tutorial/deployment/jar/

In the tutorial you will also find information about the Manifest file. As long as this has a main-class entry then just double click on the jar file will execute the program.
http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html

Of course I am assuming that you are using windows. If not then you will need to investigate some more.

2007-10-28 21:09:48 · answer #1 · answered by AnalProgrammer 7 · 0 1

Because Java doesn't compile to machine language, that's why. It runs in the JVM. You can wrap it in an executable, but it's still Java code inside.

2016-04-11 00:31:55 · answer #2 · answered by Barbara 4 · 0 0

Did you explore the tools that come with while you install the Java package from Sun or such implementors?

There are tools in the gcc suite to compile java sources to executables on Linux. Not sure for Windows(I safely assume since you mention Notepad).

2007-10-28 21:03:16 · answer #3 · answered by Anonymous · 1 0

If you do, you lose the platform independence that makes Java so useful. Most of the current JVM's use 'JIT' technology to make repetetive functions practically as fast as an .EXE file.

Hope this helps.

2007-10-29 13:04:36 · answer #4 · answered by oldguy 4 · 0 0

You need a Java compiler that can compile to native machine code. The GNU compiler is one such compiler:
http://gcc.gnu.org/java/

2007-10-28 22:39:22 · answer #5 · answered by Anonymous · 0 1

fedest.com, questions and answers