Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Files ".exe" in Java?.

Status
Not open for further replies.

Carzstop

Technical User
May 20, 2000
13
0
0
ES

Hi everybody.

I`m really new in Java, and firstly, what I need to know is this:

May I have Java files ".exe" to run in a NT server?.

How can compile the Java files into an "exe" file?.

Thanks.
[sig][/sig]
 
Java files, once they have been copiled do not form .exe files. You can force java to compile into a .exe but that brakes alot of things. *.exe are system depended, a exe on a Linux,Unix,Dos,Windows 9x, machine are completely different things. The whole idea behind java is to allow it to work on multiple Operating Systems. What you do is take your compiled .class file. That .class gets called by the Java Runtime Files which control Operation System dependent variables and is run.... If you want a system dependent program use c++....

good luck :)
[sig]<p>ackka<br><a href=mailto:tmoses@iname.com>tmoses@iname.com</a><br><a href= my site</a><br>"Do No Harm, Leave No Tracks"<br>
ICMP Summer 2000, 2600 Article<br>
<br>
[/sig]
 
Just a little bit of history(well not really that but its the best word i can think of). Most common (well common a few years ago) languages like C or C++ are compiled to byte code for the particular software/hardware combination for the machine they were compiled on. With windows this was not much of a probelm because the majority of the machines that run windows are based on the i386 (ibm compatible pc) model. However a lot of other machines around (Macs, Sparcs, mips ..) couldnt recognise these files also the couldnt run windows and used some other OS like Solaris, MacOs, linux etc. When an application needed to be run on one of these machines it needed to be re compiled from the source code (which is why a lot of linux programs are distributed as source code, so that the particular flavour of linux didn't need to be know to distribute the software, although you can still get precomplied apps if you can't be bothered compiling them).

The idea with java was that the compiled class files would be executable on any machine under any OS. Java files are compiled to virtual machince byte code, no machine will directly execute these (except for the pico-java processor) instead the will get the java interpreter to perform JIT(just in time) compilation to the native machine code for execution. The clear advantage being that you don't have to publish your source code and you don't have to recompile it for a new platform. the disadvantage, as i'm sure people have noticed, is that the whole proceess is really slow when compared to the native machine code option. Sun are putting effort in making the java interpreter faster making this less of a problem.

Visual basic takes a different approach and just interprets the source code directly. I havent seen any statistics, and i'd be interested if any one has, on how this approach compares to java. Certainly we wont be seeing a VB interpreter for linux any time soon.

Also a interesting piece of info GNU( who make gcc which really kicks butt for C, are actually working on a java to machine code compiler called gcj (or gjc i cant remember) the idea being to utilise the good libraries provided by java but have them so you can run them as fast as native code. It kind of goes against the idea of java but it will make your applications run faster if you need them to. Last i heard the haddn't implemented any gui stuff (swing and awt) for the compiler but weren't far away. [sig]<p>Chris Packham<br><a href=mailto:kriz@i4free.co.nz>kriz@i4free.co.nz</a><br><a href= > </a><br>A thousand mokeys at a thousand machines, it happened, it got called the internet.[/sig]
 
whoops got a bit carried away and forgot to mention if you just want your application to run without having to open a dos shell and type [tt]java blah blah blah[/tt] you could write a batch file (.bat) which will just have the normal stuff you'd type on the command line in it. this saves a lot of time and you can execute it from windows explorer or a desktop shortcut [sig]<p>Chris Packham<br><a href=mailto:kriz@i4free.co.nz>kriz@i4free.co.nz</a><br><a href= > </a><br>A thousand mokeys at a thousand machines, it happened, it got called the internet.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top