469,315 Members | 2,012 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,315 developers. It's quick & easy.

How to make a executable file, such as myprogram.exe, for java ?

Hello,

I have some java classes. But, I don't want my users to type "java
my_java_program" every time they run the java class ?
How do I pack them together into one executable file, like
myprogram.exe. ?
Any tools can do this for me ??

Thanks & regards,
June
Jul 17 '05 #1
6 28637
QQ June wrote:
Hello,

I have some java classes. But, I don't want my users to type "java
my_java_program" every time they run the java class ?
How do I pack them together into one executable file, like
myprogram.exe. ?
Any tools can do this for me ??


This is the sort of thing that scripting languages are for.

Creating an EXE file out of Java sources is generally evil. Java is
designed to be completely platform-neutral -- your .class files are able
to run on any OS and hardware platform. As soon as you package them
into an EXE file, however, you've now locked your code to run on ONE OS
on ONE hardware platform.

Instead of doing this, package your classes into a runnable JAR file.
Then create a script that will launch it for the user.

HTH!

Brad BARCLAY

--
=-=-=-=-=-=-=-=-=
From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
The jSyncManager Project: http://www.jsyncmanager.org


Jul 17 '05 #2
On Thu, 02 Oct 2003 09:15:27 -0700, QQ June wrote:
Hello,

I have some java classes. But, I don't want my users to type "java
my_java_program" every time they run the java class ?
How do I pack them together into one executable file, like
myprogram.exe. ?
Any tools can do this for me ??

Thanks & regards,
June


Hi June,

I have already seen one reply on this suggesting you to wrap the Java
program in a script containg the something like java my_java_program. If
it is native code (so you can run it on a machine without a Java VM, javac
will not help you) you
have to buy a special compiler for that if it is for
Windows (I have not seen any free ones for Windows yet). For Linux you
could use gcc with the option for Java code, but that is only for Linux
native code.

Best Regards
Kristian
Jul 17 '05 #3
qk****@yahoo.com (QQ June) wrote in message news:<56**************************@posting.google. com>...
Hello,

I have some java classes. But, I don't want my users to type "java
my_java_program" every time they run the java class ?
How do I pack them together into one executable file, like
myprogram.exe. ?
Any tools can do this for me ??

Thanks & regards,
June


Check out JSmooth, http://jsmooth.sourceforge.net/index.php If you
must make it an .exe.

Stian
Jul 17 '05 #4
qk****@yahoo.com (QQ June) wrote in message news:<56**************************@posting.google. com>...
Hello,

I have some java classes. But, I don't want my users to type "java
my_java_program" every time they run the java class ?
How do I pack them together into one executable file, like
myprogram.exe. ?
Any tools can do this for me ?? Thanks & regards,
June


hi there
i have written a c program that invokes java for you & you can also
provide any options or command line arguments .....
no support yet provided for .jar files (work in progress)

if you require it, i can mail it to you

its a simple .exe file which you can associate with your .class files
& then you can run your .class files just by double clicking them from
explorer
or even lets say if your file is Demo.class then you can run it at
command prompt

c:\ur_dir>Demo.class

i picked it up from an online tutorial.
if you want to write one heres the logic

parse your input & remove .class extension & also absolute path
provided if any
accept options switches
accept command line arguments
form a complete string with "java.exe " + options + class_name +
cmdline_arguments
invoke it & you are done.

remember the file does not touch your .class files, it just makes use
of windows file association feature.

regards
amey
Jul 17 '05 #5
On 10/4/03 1:37 AM, in article
66**************************@posting.google.com, "Amey Samant"
<am*****@yahoo.com> wrote:
Hello,

I have some java classes. But, I don't want my users to type "java
my_java_program" every time they run the java class ?
How do I pack them together into one executable file, like
myprogram.exe. ?
Any tools can do this for me ??

Thanks & regards,
June


hi there
i have written a c program that invokes java for you & you can also
provide any options or command line arguments .....
no support yet provided for .jar files (work in progress)


Borland's JBuilder has the ability to do this. The price is steep, though.
Anthony

--
Got a 'blog? Post it: http://www.martin-studio.com/weblog-index/

Jul 17 '05 #6
Why don't you just write a DOS .bat file to do this?

I remember there was a utility to convert a DOS batch file to an .exe if you
need to run as an .EXE file.

"QQ June" <qk****@yahoo.com> wrote in message
news:56**************************@posting.google.c om...
Hello,

I have some java classes. But, I don't want my users to type "java
my_java_program" every time they run the java class ?
How do I pack them together into one executable file, like
myprogram.exe. ?
Any tools can do this for me ??

Thanks & regards,
June

Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Eric | last post: by
1 post views Thread by knutsample | last post: by
1 post views Thread by Paul Sullivan | last post: by
2 posts views Thread by somyav | last post: by
2 posts views Thread by ward.david | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.