View previous topic :: View next topic |
Author |
Message |
alexraasch Tux's lil' helper
Joined: 14 Nov 2003 Posts: 94 Location: Rostock, Germany
|
Posted: Tue Jan 03, 2006 11:41 am Post subject: Java 2 EXE? |
|
|
I have written a Java program that I wanto to give to a colleague of mine. Unfortunately, he runs Windows with a jre of 1.3 or so. My program is 1.5 source. How can I make an exe file for him that includes jre 1.5? Is it possible at all? |
|
Back to top |
|
|
Denkino n00b
Joined: 26 Nov 2004 Posts: 26
|
Posted: Tue Jan 03, 2006 12:20 pm Post subject: |
|
|
then just ship off the classes or make an executable jar. |
|
Back to top |
|
|
alexraasch Tux's lil' helper
Joined: 14 Nov 2003 Posts: 94 Location: Rostock, Germany
|
Posted: Tue Jan 03, 2006 1:58 pm Post subject: |
|
|
Sorry, that won't work because if you write 1.5 source files you need a 1.5 jre to run it. 1.5 includes many features that older versions don't. What about gcj? Have you ever used it? |
|
Back to top |
|
|
alexraasch Tux's lil' helper
Joined: 14 Nov 2003 Posts: 94 Location: Rostock, Germany
|
Posted: Tue Jan 03, 2006 2:43 pm Post subject: |
|
|
I just checked the gcj homepage. Seems as if major things like all the gui stuff is still missing in the gcj library, so that's not my soution either. |
|
Back to top |
|
|
Denkino n00b
Joined: 26 Nov 2004 Posts: 26
|
Posted: Tue Jan 03, 2006 3:19 pm Post subject: |
|
|
Oh, ok, wasn't aware that it was an issue of what classes/methods you used..
but, i guess, the bigger issue is why doesn't your recipient want to upgrade? and why can't they just download the free sun jre themselves? |
|
Back to top |
|
|
alexraasch Tux's lil' helper
Joined: 14 Nov 2003 Posts: 94 Location: Rostock, Germany
|
Posted: Tue Jan 03, 2006 3:40 pm Post subject: |
|
|
The problem is he's a computer beginner and I don't think he's able to do the update. Furthermore, the program is intended to be used by many other users who don't know much about computers either. That's why I want everything to be as simple as possible: double-click the exe and go! |
|
Back to top |
|
|
avendesora Veteran
Joined: 16 Aug 2002 Posts: 1739 Location: Betelgeuse vicinity
|
Posted: Tue Jan 03, 2006 5:56 pm Post subject: |
|
|
I don't think that's possible. Sun doesn't allow you to redistribute their JREs (or JDKs). IBM does the same thing.
Blackdown probably would, but I'm not sure where they are at with 1.5 support, and they don't ship for windows.
GCJ not quite there yet as has been mentionned, even on Linux/UNIX type OS.
Either rewrite so that your code is 1.3 compliant, or have people update their VMs. (Make a nice HOWTO if they
don't know how to do it.) |
|
Back to top |
|
|
robbyjo Guru
Joined: 06 Apr 2003 Posts: 462
|
Posted: Tue Jan 03, 2006 8:00 pm Post subject: |
|
|
Use this trick:
Make an executable launcher that invoke java along with the necessary options and the jar file. You can construct one using Java and compile it with GCJ or you can use C/C++. Take your pick. Generally, the launcher contents is like this:
Code: | void main() {
exec("java -classpath myprog.jar org.mypackage.MainClass");
} |
Now, the last problem would be to ask him to install a JDK...
Alternatively, if you have some $$ to spare, you can use Excelsior's JET.
HTH. |
|
Back to top |
|
|
UncleOwen Veteran
Joined: 27 Feb 2003 Posts: 1493 Location: Germany, Hamburg
|
Posted: Tue Jan 03, 2006 8:33 pm Post subject: |
|
|
I fail to see how this would magically convert a JRE1.3 into a JRE5. |
|
Back to top |
|
|
hackerssidekick n00b
Joined: 02 Apr 2004 Posts: 3 Location: New Zealand
|
Posted: Wed Jan 04, 2006 8:42 am Post subject: |
|
|
Denkino wrote: |
then just ship off the classes or make an executable jar. |
Surely this would work, even if the source is 1.5! Does running that give you an error or is there something else?
Cheers,
Vipul _________________ teh hacker's sidekick strikes again... |
|
Back to top |
|
|
UncleOwen Veteran
Joined: 27 Feb 2003 Posts: 1493 Location: Germany, Hamburg
|
Posted: Wed Jan 04, 2006 12:25 pm Post subject: |
|
|
What if the code contains classes that were not present in 1.3? e.g. enums... |
|
Back to top |
|
|
robbyjo Guru
Joined: 06 Apr 2003 Posts: 462
|
Posted: Thu Jan 05, 2006 8:30 am Post subject: |
|
|
UncleOwen wrote: | I fail to see how this would magically convert a JRE1.3 into a JRE5. |
Not magically convert, but it provided a launcher. alexraasch asked on how to make things easier for deployment. To some degree, the code I supplied can ease deployment to some degree. |
|
Back to top |
|
|
hackerssidekick n00b
Joined: 02 Apr 2004 Posts: 3 Location: New Zealand
|
Posted: Thu Jan 05, 2006 9:34 am Post subject: |
|
|
UncleOwen wrote: | What if the code contains classes that were not present in 1.3? e.g. enums... |
hmmm didn't think of new classes. I know that stuff like generics etc is transformable to 1.3/1.4 code by the compiler. _________________ teh hacker's sidekick strikes again... |
|
Back to top |
|
|
robbyjo Guru
Joined: 06 Apr 2003 Posts: 462
|
Posted: Thu Jan 05, 2006 9:11 pm Post subject: |
|
|
There are bunch of new classes in JDK 1.5, such as StringBuilder and stuffs. |
|
Back to top |
|
|
Catch-22 Apprentice
Joined: 22 Oct 2004 Posts: 244
|
Posted: Thu Jan 05, 2006 10:48 pm Post subject: |
|
|
I don't see an easy way to get what you want.
You might want to consider writing your own implementations of the 1.5-only API libraries that you're using or remove your code's dependency on them all together. |
|
Back to top |
|
|
incabolocabus Apprentice
Joined: 24 Nov 2003 Posts: 232 Location: Fort Collins, CO
|
Posted: Thu Jan 05, 2006 11:22 pm Post subject: |
|
|
Quote: | The problem is he's a computer beginner and I don't think he's able to do the update. |
Following a link to the download page, selecting the download, and double-clicking on it?
Perhaps with a few hints on how to step through the installer?
Java Webstart should also prompt for a jre upgrade if setup right. _________________ 1970s Sears Hawthorne, green, 3 gears, front and rear fenders, rear dual basket rack, overclocked to 1.3 hz. |
|
Back to top |
|
|
|