Valhalla Legends Forums Archive | Java Programming | Standalone .exe's?

AuthorMessageTime
iago
How do you make standalone .exe files in Java? I know I've seen them before, and it would be nice to be able to.

Thanks!
December 6, 2003, 10:14 PM
Kp
(and does so by default). Don't know if there are other things which can do so. Note that, as a native exe, it won't have the portability of a normal .class file. Also, it is probably not possible to decompile it back into the original .java file (however, a .class file can supposedly be fully decompiled).
December 7, 2003, 12:52 AM
Hostile
Yes, its more then possible to decompile java classes, which is quite obvious as to why. I think its even a feature in JBuilder iirc. You can also disassemble classes though javap which is provided with JDK. Yes, obviously there are ways to make .exes with java, however as Kp noted its not by the terms "100% Pure Java", which contrary takes away all of javas portability and there for needs to be recompiled on different platforms. If you're looking for a way to execute java as a standalone then theres an alternative to not taking away its portability, use .jar files. If system paths are configured correctly can use a jar file to execute a class thats archived inside the jar file (which is its main purpose).
December 7, 2003, 1:32 AM
Kp
...is that you can optimize the code. Native code tends to run faster than bytecode, especially when you let the optimizer take a crack at it. If you run into some pre-existing Java code that you really need to perform well, compiling it native may be the solution if you don't have time to do the sensible thing (porting it to a language where speed was a design consideration ;)).
December 7, 2003, 3:15 AM
iago
My main reason is that I want to be able to show programs to my friend/whatever, but if he can't run .class files easily (perhaps doesn't have the stuff installed)
December 7, 2003, 2:21 PM
Kp
I'm pretty sure most Windows OSes will have some sort of Java VM installed already (whether this is good or not is another issue...)
December 7, 2003, 5:24 PM
St0rm.iD
[quote author=Kp link=board=34;threadid=4115;start=0#msg34132 date=1070817859]
I'm pretty sure most Windows OSes will have some sort of Java VM installed already (whether this is good or not is another issue...)
[/quote]

No.
December 7, 2003, 10:56 PM
iago
By default, windows can't do anything with .class files afaik.
December 7, 2003, 11:02 PM
Kp
... without having explicitly installed it on any of them, all the computers I have access to have a Java VM (java.exe) already installed. It's not associated with .class in the Windows shell, so Windows doesn't think it can do anything with them, but you can use it to run the class files from the command line.
December 7, 2003, 11:57 PM
iago
... which is why I want to be able to make .exe's instead of having .class files. It's fine if it's still bytecode+VM, as long as they don't need installed software to use it.
December 8, 2003, 8:49 AM
j0k3r
If you had a .class file, and had VM installed, would it just open a window and run it? Because I'm pretty sure about 90% of the computers out there have VM installed.
December 8, 2003, 12:41 PM
St0rm.iD
1) I'm pretty sure they don't have the VM
2) Clicking a class file won't do anything, however, an executable JAR would do something if the VM is installed.
December 8, 2003, 2:16 PM
iago
[quote author=j0k3r link=board=34;threadid=4115;start=0#msg34251 date=1070887298]
If you had a .class file, and had VM installed, would it just open a window and run it? Because I'm pretty sure about 90% of the computers out there have VM installed.
[/quote]

90% just doesn't cut it all the time :P

December 8, 2003, 5:36 PM
Hostile
[quote author=St0rm.iD link=board=34;threadid=4115;start=0#msg34260 date=1070893015]
1) I'm pretty sure they don't have the VM
2) Clicking a class file won't do anything, however, an executable JAR would do something if the VM is installed.
[/quote]

I already said that, and almost any computer with a webbrowser has the Java VM. Iago, I think you should just consider some sort of executable solution(.jar or .exe) or some more inconvienent alternative, like an applet.
December 8, 2003, 11:57 PM
St0rm.iD
[quote author=Hostile link=board=34;threadid=4115;start=0#msg34370 date=1070927851]
[quote author=St0rm.iD link=board=34;threadid=4115;start=0#msg34260 date=1070893015]
1) I'm pretty sure they don't have the VM
2) Clicking a class file won't do anything, however, an executable JAR would do something if the VM is installed.
[/quote]

I already said that, and almost any computer with a webbrowser has the Java VM. Iago, I think you should just consider some sort of executable solution(.jar or .exe) or some more inconvienent alternative, like an applet.
[/quote]

Um no. The Java VM you're talking about works for Java 1.1...and I don't think they usually support standalone JARs or apps, either.
December 9, 2003, 1:01 AM
iago
[quote author=Hostile link=board=34;threadid=4115;start=0#msg34370 date=1070927851]
[quote author=St0rm.iD link=board=34;threadid=4115;start=0#msg34260 date=1070893015]
1) I'm pretty sure they don't have the VM
2) Clicking a class file won't do anything, however, an executable JAR would do something if the VM is installed.
[/quote]

I already said that, and almost any computer with a webbrowser has the Java VM. Iago, I think you should just consider some sort of executable solution(.jar or .exe) or some more inconvienent alternative, like an applet.
[/quote]

I AM considering an executable solution, .exe in particular.
December 9, 2003, 3:45 AM
Hostile
[quote author=St0rm.iD link=board=34;threadid=4115;start=0#msg34387 date=1070931677]
Um no. The Java VM you're talking about works for Java 1.1...and I don't think they usually support standalone JARs or apps, either.
[/quote]

Well, prove it. I'm not sure where exactly they're bundling the Java VM and RTE so if you have somewhere with this info please share~. Also, I remember sky mentioning that they stopped bundling the Java VM with Internet Explorer, this was somewhat recent (6.0) but not sure how thats all going about.
December 9, 2003, 6:30 AM
j0k3r
[quote author=Hostile link=board=34;threadid=4115;start=15#msg34408 date=1070951418]
[quote author=St0rm.iD link=board=34;threadid=4115;start=0#msg34387 date=1070931677]
Um no. The Java VM you're talking about works for Java 1.1...and I don't think they usually support standalone JARs or apps, either.
[/quote]

Well, prove it. I'm not sure where exactly they're bundling the Java VM and RTE so if you have somewhere with this info please share~. Also, I remember sky mentioning that they stopped bundling the Java VM with Internet Explorer, this was somewhat recent (6.0) but not sure how thats all going about.
[/quote]
Does it even matter? You can download and it install it for free and with no hassle (once a java applet tries to be executed and you don't have VM, it will install from the website, or atleast at school it does).
December 9, 2003, 12:12 PM
SNiFFeR
We just got these books in, the name of the books are [u]Java™ Software solutions for the AP Computer Science.[/u]
December 9, 2003, 2:36 PM
St0rm.iD
[quote author=j0k3r link=board=34;threadid=4115;start=15#msg34425 date=1070971960]
[quote author=Hostile link=board=34;threadid=4115;start=15#msg34408 date=1070951418]
[quote author=St0rm.iD link=board=34;threadid=4115;start=0#msg34387 date=1070931677]
Um no. The Java VM you're talking about works for Java 1.1...and I don't think they usually support standalone JARs or apps, either.
[/quote]

Well, prove it. I'm not sure where exactly they're bundling the Java VM and RTE so if you have somewhere with this info please share~. Also, I remember sky mentioning that they stopped bundling the Java VM with Internet Explorer, this was somewhat recent (6.0) but not sure how thats all going about.
[/quote]
Does it even matter? You can download and it install it for free and with no hassle (once a java applet tries to be executed and you don't have VM, it will install from the website, or atleast at school it does).
[/quote]

Granny can't do this, and 56k'ers don't want to wait.
December 9, 2003, 9:01 PM
j0k3r
56k'ers don't matter and I don't see what use a granny has for Java.
December 9, 2003, 9:20 PM
iago
Maybe she wants to use a cookbook, and are you saying that spht and other people who don't live in areas with highspeed don't matter?
December 9, 2003, 9:26 PM
j0k3r
[quote author=iago link=board=34;threadid=4115;start=15#msg34483 date=1071005210]
Maybe she wants to use a cookbook, and are you saying that spht and other people who don't live in areas with highspeed don't matter?
[/quote]
No, I'm saying that it doesn't matter if it takes forever for them (not speaking from their point of view ofcourse), you download it once and you're good to go, so if you have 56k might as well just put up with it cause nothing is going to change (if you can't get 56k).

The ones who don't matter are the AOL'ers in major cities who whine about 56k but don't do anything about it.

Screw the grandma, she falls into either category and doesn't deserve her own, and if she has 56k, it's her own choice (or not) to live with it.
December 9, 2003, 10:27 PM
St0rm.iD
Or you just can't admit defeat.
December 9, 2003, 10:34 PM
j0k3r
STOP MAKING FUN OF ME
[me=j0k3r]runs[/me]

Anyways, Iago you find a way to do it yet?
December 10, 2003, 12:02 AM
iago
[quote author=j0k3r link=board=34;threadid=4115;start=15#msg34531 date=1071014549]
STOP MAKING FUN OF ME
[me=j0k3r]runs[/me]

Anyways, Iago you find a way to do it yet?
[/quote]

No, and I haven't been trying. Too much work to do right now for school and such.
December 10, 2003, 12:11 AM
Hostile
j0k3r... Ok, as flawless as your idea is and I sure to some aspect I know this is also fine, thats just about the worse point of view you could have as far as its concerned. Yes, I know where to download it and install it in less then a minute but I don't think everyone else can do the same, and its quite pointless to expect them to know how to either. I can honestly say I went through a stage where I thought I was a god because I knew more then almost everyone I would run into in real life about computers, but this doesnt last very long. As soon as you figure out that no matter how much you know in your own little world, you tend to lose that as soon as someone comes along talking about something you have no clue about :P Grandma might not know how use a computer, but she could probably kick your ass in whatever she did in her time ;)
December 10, 2003, 1:49 AM
j0k3r
That's because she's been doing it for 50-someodd years...

I thought the VM download automatically popped up when an applet tries to run and you don't have VM installed.
December 10, 2003, 3:08 AM
DaRk-FeAnOr
There are many applications on the market that do this for you. Compilers to stand alone .exes. Some of them work for one operating system (so you would have to get a different compiler for each OS N.B. no source change required) and some of them work for all, but they can burna hole in your wallet.
December 11, 2003, 3:31 AM
hismajesty
[quote author=DaRk-FeAnOr link=board=34;threadid=4115;start=15#msg34741 date=1071113514]
There are many applications on the market that do this for you. Compilers to stand alone .exes. Some of them work for one operating system (so you would have to get a different compiler for each OS N.B. no source change required) and some of them work for all, but they can burna hole in your wallet.
[/quote]

That's what pirates are for :P
December 11, 2003, 2:27 PM
Hostile
j0k3r, you're developing a habit of totally missing someones point. I suggest either work on improving your reading skills or getting your eyes examined... perhaps its just your comprehension or denial of being stupid? Either way, we already found a great free compiler for making java standalone executables and the best place to get the VM is on www.java.com so lets leave it at that. :P
December 12, 2003, 3:55 AM
iago
http://download.com.com/3000-2417-1987574.html?tag=lst-0-1

Apparently, this can run .class files as if they were normal .exe files.

- Thanks to MorsRedigo for finding this - (I promised I'd give him credit :))
January 19, 2004, 5:55 PM
St0rm.iD
That's no different than an executable JAR...except worse.
January 19, 2004, 8:49 PM
iago
How do you make a jar executable? I didn't even know jar's existed until just recently.

Note: he needs it for a windows machine.
January 19, 2004, 9:09 PM
St0rm.iD
Cross platform my friend :)

Look up the docs for the jar tool; my commands might be wrong, haven't done java in a loooong time.


Basically, you have a bunch of .class files for your application. One of them has a main() method. You create a special "manifest" file, which looks like:
[code]
Main-class: mypackage.MyClass

[/code]
Remember the trailing endline! Then execute something like:
[code]
jar cvfm MyJarFile.jar manifest packagename
[/code]
January 20, 2004, 12:27 AM

Search