Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #1084

Re: Help for Swing and database with .exe

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.help
Subject Re: Help for Swing and database with .exe
Date 2011-09-22 08:10 -0700
Organization http://groups.google.com
Message-ID <20976399.865.1316704204422.JavaMail.geo-discussion-forums@preb19> (permalink)
References <8576a9b2-7684-4331-844e-50e7da96abed@f8g2000yqf.googlegroups.com> <j5ffmu$ss0$1@dont-email.me>

Show all headers | View raw


markspace wrote:
> Kirti Waykole wrote:
>> now i want to make .exe file of this application.
> 
> As far as I know, there's no way to get an .exe file from Java.

There used to be such, but perhaps they went away due to lack of need. Inevitably they had to package at least part of the JVM in the .exe, so the process is pretty horrid when it even exists.  

Kirti, you shouldn't make an EXE out of Java programs.  That kind of defeats the point of Java, which is cross-platform and runs on its own virtual operating system called the Java Virtual Machine (JVM).  To run like that, the host operating system such as Windows invokes the "java" command (java.exe on Windows), which sets up the JVM and runs the application. 

To deploy a Java application, you can run the Java class directly from the "java" command, sort of like this:

  java -cp /some/directory;/some/other/directory com.lewscanon.foo.Foo

where "com.lewscanon.foo.Foo" is a Java class (because Java only runs Java classes, right?).  

You can also package a Java application into a Java Archive (JAR) file, one that ends in the extension ".jar".  JAR files are sort of a cross between EXE and DLL files in the Windows world, but intended for the JVM only.

The "java" command has a special "-jar" option to run the packaged application, sort of like this:

  java -jar foo.jar

To make things Windows-friendly without sacrificing the independence that Java gives you, you make a CMD file (Windows "command" or shell file) that invokes the "java" command.  You can then run that CMD file directly from Windows.

-- 
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Help for Swing and database with .exe Kirti Waykole <waykole.kirti@gmail.com> - 2011-09-22 04:04 -0700
  Re: Help for Swing and database with .exe markspace <-@.> - 2011-09-22 07:11 -0700
    Re: Help for Swing and database with .exe Lew <lewbloch@gmail.com> - 2011-09-22 08:10 -0700
  Re: Help for Swing and database with .exe Roedy Green <see_website@mindprod.com.invalid> - 2011-09-22 11:48 -0700
    Re: Help for Swing and database with .exe Kirti Waykole <waykole.kirti@gmail.com> - 2011-09-22 21:19 -0700

csiph-web