Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Java 2 EXE?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
alexraasch
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2003
Posts: 94
Location: Rostock, Germany

PostPosted: Tue Jan 03, 2006 11:41 am    Post subject: Java 2 EXE? Reply with quote

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
View user's profile Send private message
Denkino
n00b
n00b


Joined: 26 Nov 2004
Posts: 26

PostPosted: Tue Jan 03, 2006 12:20 pm    Post subject: Reply with quote

Code:

javac -target 1.3


then just ship off the classes or make an executable jar.
Back to top
View user's profile Send private message
alexraasch
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2003
Posts: 94
Location: Rostock, Germany

PostPosted: Tue Jan 03, 2006 1:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
alexraasch
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2003
Posts: 94
Location: Rostock, Germany

PostPosted: Tue Jan 03, 2006 2:43 pm    Post subject: Reply with quote

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. :cry:
Back to top
View user's profile Send private message
Denkino
n00b
n00b


Joined: 26 Nov 2004
Posts: 26

PostPosted: Tue Jan 03, 2006 3:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
alexraasch
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2003
Posts: 94
Location: Rostock, Germany

PostPosted: Tue Jan 03, 2006 3:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
avendesora
Veteran
Veteran


Joined: 16 Aug 2002
Posts: 1739
Location: Betelgeuse vicinity

PostPosted: Tue Jan 03, 2006 5:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
robbyjo
Guru
Guru


Joined: 06 Apr 2003
Posts: 462

PostPosted: Tue Jan 03, 2006 8:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
UncleOwen
Veteran
Veteran


Joined: 27 Feb 2003
Posts: 1493
Location: Germany, Hamburg

PostPosted: Tue Jan 03, 2006 8:33 pm    Post subject: Reply with quote

I fail to see how this would magically convert a JRE1.3 into a JRE5.
Back to top
View user's profile Send private message
hackerssidekick
n00b
n00b


Joined: 02 Apr 2004
Posts: 3
Location: New Zealand

PostPosted: Wed Jan 04, 2006 8:42 am    Post subject: Reply with quote

Denkino wrote:
Code:
javac -target 1.3


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
View user's profile Send private message
UncleOwen
Veteran
Veteran


Joined: 27 Feb 2003
Posts: 1493
Location: Germany, Hamburg

PostPosted: Wed Jan 04, 2006 12:25 pm    Post subject: Reply with quote

What if the code contains classes that were not present in 1.3? e.g. enums...
Back to top
View user's profile Send private message
robbyjo
Guru
Guru


Joined: 06 Apr 2003
Posts: 462

PostPosted: Thu Jan 05, 2006 8:30 am    Post subject: Reply with quote

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
View user's profile Send private message
hackerssidekick
n00b
n00b


Joined: 02 Apr 2004
Posts: 3
Location: New Zealand

PostPosted: Thu Jan 05, 2006 9:34 am    Post subject: Reply with quote

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
View user's profile Send private message
robbyjo
Guru
Guru


Joined: 06 Apr 2003
Posts: 462

PostPosted: Thu Jan 05, 2006 9:11 pm    Post subject: Reply with quote

There are bunch of new classes in JDK 1.5, such as StringBuilder and stuffs.
Back to top
View user's profile Send private message
Catch-22
Apprentice
Apprentice


Joined: 22 Oct 2004
Posts: 244

PostPosted: Thu Jan 05, 2006 10:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
incabolocabus
Apprentice
Apprentice


Joined: 24 Nov 2003
Posts: 232
Location: Fort Collins, CO

PostPosted: Thu Jan 05, 2006 11:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum