Off-topic Talk Where overpaid, underworked S2000 owners waste the worst part of their days before the drive home. This forum is for general chit chat and discussions not covered by the other off-topic forums.

How to convert a Java program into a Windows executable ?

Thread Tools
 
Old 06-30-2003, 12:35 PM
  #1  

Thread Starter
 
s2kdriver80's Avatar
 
Join Date: Nov 2002
Location: Long Island, New York, US
Posts: 2,048
Received 7 Likes on 6 Posts
Default How to convert a Java program into a Windows executable ?

I've made a Java program (a series of .java files) and I'm wondering how to convert that into a Windows-based executable. This will be used on our clients' computers and this whole process needs to be as painless as possible - the JRE/JDK would obviously have to be somehow packaged into the executable since I can't ask a client to go to Sun's site and dl the whole package since it would be too much work. How would I go about doing this? Thanks.
Old 06-30-2003, 12:52 PM
  #2  
Registered User

 
PeaceLove&S2K's Avatar
 
Join Date: Jul 2002
Location: San Diego, CA
Posts: 19,257
Received 18 Likes on 16 Posts
Default

Sun allows you to distribute JRE with your java apps if I'm not mistaken. You'll want to compile your .java files into .class files first though.
Old 06-30-2003, 12:55 PM
  #3  
Registered User

 
PeaceLove&S2K's Avatar
 
Join Date: Jul 2002
Location: San Diego, CA
Posts: 19,257
Received 18 Likes on 16 Posts
Default

I'd advise compiling all your files and putting them in a jar (Main class file should be specified using Main-class: in the manifest), and then downloading JRE. Put everything in a directory, and write a batch (.bat or .cmd) file to execute your jar. Zip the whole thing up and send it to your client.

Or you can download Microsoft's JDK, which allows you to compile classes into self contained .exes. If you go the M$ route however, you'll be limited to java 1 features (i.e., J2SE features won't be supported).
Old 06-30-2003, 01:28 PM
  #4  
Former Moderator

 
The Unabageler's Avatar
 
Join Date: Oct 2000
Location: internet
Posts: 20,448
Likes: 0
Received 0 Likes on 0 Posts
Default

format c: *.java

it'll format the java files to work on your harddrive.
Old 06-30-2003, 01:32 PM
  #5  

 
nexus's Avatar
 
Join Date: Oct 2001
Location: Santa Cruz
Posts: 1,225
Likes: 0
Received 0 Likes on 0 Posts
Default

I'll just have to be -mostly- quiet on this one since I'm not a developer...... that said, why the hell are you using java? There are lots of respectable alternatives.
Old 06-30-2003, 02:49 PM
  #6  

 
erik's Avatar
 
Join Date: Oct 2000
Location: South Jersey
Posts: 752
Received 8 Likes on 3 Posts
Default

nexus,

You have no idea what he has developed. How do you know the other "respectable" alternatives didn't fit his needs? And why is Java not respectable? You know, since you are not a developer and all.

If you want to go a longer route, you could develop a C++ app that makes JNI calls to your Java code. There is a wrapper to JNI called Jace that is helpful in using JNI.

That's the hard way though, but it would look exactly like a Windows exe. Have the users add the jar to the classpath (or do this during the Install, if you have one), and things should go pretty smoothly. And if you don't know JNI, it would be a good exercise.

ERIK
Old 06-30-2003, 03:14 PM
  #7  
Registered User

 
PeaceLove&S2K's Avatar
 
Join Date: Jul 2002
Location: San Diego, CA
Posts: 19,257
Received 18 Likes on 16 Posts
Default

[QUOTE]Originally posted by erik
[B]
If you want to go a longer route, you could develop a C++ app that makes JNI calls to your Java code.
Old 06-30-2003, 11:58 PM
  #8  

 
exzeltus's Avatar
 
Join Date: Apr 2002
Location: Dacula
Posts: 399
Likes: 0
Received 1 Like on 1 Post
Default

wow, I was wandering the same thing a week ago. Just wanna stay on this thread to see where it goes.

I've never even knew of JNI. You'd think all those classes that I took in Java, they'd tell you that JNI existed for that one class you actually had to code in C++.
Old 07-01-2003, 06:24 AM
  #9  

Thread Starter
 
s2kdriver80's Avatar
 
Join Date: Nov 2002
Location: Long Island, New York, US
Posts: 2,048
Received 7 Likes on 6 Posts
Default

I'll look into it but I was hoping my JBuilder 6.0 development environment editor would include a feature where it could turn a package of Java classes into a "runnable" (executable-like) program.
Old 07-01-2003, 06:42 AM
  #10  
Registered User
 
thunderchicken's Avatar
 
Join Date: Mar 2002
Location: Zionsville
Posts: 1,457
Likes: 0
Received 0 Likes on 0 Posts
Default

J#.NET

I bet there's some way to import files, though I'm writing in C# right now.


Quick Reply: How to convert a Java program into a Windows executable ?



All times are GMT -8. The time now is 11:58 AM.