Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating java exe

Status
Not open for further replies.
Jun 30, 2003
196
GB
Hi
i have an OK knowledge of the java language, what i have learnt so far i just compile in the command line and run in the command line.
My question is how do i make it into an application that can be run from windows perhaps with an icon? is this a massive task? Also i would also like someone to explain to me how i can save a program so that next timew it is opened the variables are the same state as when it was closed.

 
>>> how do i make it into an application that can be run from windows perhaps with an icon?


>>> Also i would also like someone to explain to me how i can save a program so that next timew it is opened the variables are the same state as when it was closed.


Your two options are ::
- Write out variables to a file somewhere

- Write a class that encapsulates the data you need to persist, then serialize this object (see Serializable class) into a stream and write the byte data to a db or file.
 
>>> how do i make it into an application that can be run from windows perhaps with an icon?

or create a windows batch file .bat (plain text file with a bat extension) with a few lines
Code:
SET W=%CLASSPATH%
SET CLASSPATH=.;MyArchive.jar;%CLASSPATH%

java myprog

REM Environment variables are global in DOS, so we must restore the
REM original CLASSPATH.
SET CLASSPATH=%W%


Alistair [monkey]
 
What so i create this .bat file and this is what will open up my program in windoes?
 
There is no need for bat files. Java 2 Platform now has executable JAR file. Archive your classes into JAR format and specify the Main-Class parameter of your manifest file to point at the main class of your program.

eg.
Manifest-Version: 1.0
Main-Class: mymain

(In this case, mymain.class contains the main method)

To execute the JAR files, you just need to double-click on mymain icon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top