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 Jun 30, 2003 | 12:35 PM
  #1  
s2kdriver80's Avatar
Thread Starter
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Nov 2002
Posts: 2,048
Likes: 8
From: Long Island, New York, US
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.
Reply
Old Jun 30, 2003 | 12:52 PM
  #2  
PeaceLove&S2K's Avatar
20 Year Member
 
Joined: Jul 2002
Posts: 19,257
Likes: 19
From: San Diego, CA
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.
Reply
Old Jun 30, 2003 | 12:55 PM
  #3  
PeaceLove&S2K's Avatar
20 Year Member
 
Joined: Jul 2002
Posts: 19,257
Likes: 19
From: San Diego, CA
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).
Reply
Old Jun 30, 2003 | 01:28 PM
  #4  
The Unabageler's Avatar
Former Moderator
 
Joined: Oct 2000
Posts: 20,448
Likes: 0
From: internet
Default

format c: *.java

it'll format the java files to work on your harddrive.
Reply
Old Jun 30, 2003 | 01:32 PM
  #5  
nexus's Avatar
Gold Member (Premium)
 
Joined: Oct 2001
Posts: 1,225
Likes: 0
From: Santa Cruz
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.
Reply
Old Jun 30, 2003 | 02:49 PM
  #6  
erik's Avatar
20 Year Member
 
Joined: Oct 2000
Posts: 752
Likes: 8
From: South Jersey
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
Reply
Old Jun 30, 2003 | 03:14 PM
  #7  
PeaceLove&S2K's Avatar
20 Year Member
 
Joined: Jul 2002
Posts: 19,257
Likes: 19
From: San Diego, CA
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.
Reply
Old Jun 30, 2003 | 11:58 PM
  #8  
exzeltus's Avatar
 
Joined: Apr 2002
Posts: 399
Likes: 1
From: Dacula
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++.
Reply
Old Jul 1, 2003 | 06:24 AM
  #9  
s2kdriver80's Avatar
Thread Starter
20 Year Member
Liked
Loved
Community Favorite
 
Joined: Nov 2002
Posts: 2,048
Likes: 8
From: Long Island, New York, US
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.
Reply
Old Jul 1, 2003 | 06:42 AM
  #10  
thunderchicken's Avatar
Registered User
 
Joined: Mar 2002
Posts: 1,457
Likes: 0
From: Zionsville
Default

J#.NET

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



All times are GMT -8. The time now is 06:22 PM.