-3

How can I make an executable file with Java using NetBeans IDE that file work on computer or mobile. I create jar file but I don't know why it did not work.

Filburt
  • 17,626
  • 12
  • 64
  • 115
user3000000
  • 35
  • 1
  • 1
  • 7
  • 3
    Executable files that work on desktop aren't the same as files that work "on mobile" (which mobile?). Do a google search of "netbeans export runnable jar" for more information. – Kevin Workman Apr 09 '14 at 13:16
  • http://stackoverflow.com/questions/2272107/how-can-i-convert-a-jar-file-to-an-exe-file – luchosrock Apr 09 '14 at 13:18
  • 2
    An executable JAR file on a mobile? And you tag Java EE? – Joffrey Apr 09 '14 at 13:18
  • possible duplicate of [making executable file from a java project using NetBeans](http://stackoverflow.com/questions/18088607/making-executable-file-from-a-java-project-using-netbeans) – Mohsen Kamrani Apr 09 '14 at 13:20
  • thanks very much for this information, I creating a dictionary but I don't know how to make a java file being executable file – user3000000 Apr 09 '14 at 13:21

1 Answers1

1

You can run jar file in case its manifest contains proper reference to class with main() function using command java -jar jarfile.jar. If you need Windows executable, you can use launch4j. For Android AFAIK you need to build apk file.

Alexey Malev
  • 6,408
  • 4
  • 34
  • 52
  • thanks I doing it this in cmd java -jar nameoffilejava.java but not happen any thing I create a dictionary but not display any thing – user3000000 Apr 09 '14 at 13:26
  • To execute java class, you need to do the following: 1. `public static void main(String[] args)` in your class; 2. Compile your class using command `javac Classname.java`; 3. Execute your class using command `java Classname`; – Alexey Malev Apr 09 '14 at 13:28
  • thanks I doing all this things that you are say but how can I make the file if I double clicked the file being worked as application. – – user3000000 Apr 09 '14 at 13:31