| |
|
Welcome to AstaHost - Dear Guest | |
How To Create Exe File In Java?
#1
Posted 29 May 2006 - 01:56 PM
I came to know that one can build exe files from java application. How this is possible? According to me there is no such method in java to cerate exe files. However Microsoft used to provide a free system development kit (SDK), for Java, which includes the jexegen tool. But one need install Microsoft Java Virtual Machine to run such application.
Some people suggest InstallAnyWhere.
#2
Posted 29 May 2006 - 04:31 PM
dont know the website but you can just goooogle it
It takes all the class files and packages them in an exe file, and when executed searches for the JVM, so you still need to have the JVM on the users computer, but it also has an option to include the JVM ( that would be a big file )
anyways check it out, might suit your needs as long as ur programs arent too big....
note: i think there is a big in there, you might have to put all ur class files in jar files and have it read them from the jar file for it to work correctly, you might even have to set up the manifest in the jar file to make it be able to execute as a jar if you want it to execute as an exe, not sure though you should test around with it
#3
Posted 30 May 2006 - 04:19 AM
I found JSmooth. But the problem still remains. Say for example I give a java application wrapped with JSmooth to a customer who doesn’t have internet connection. JSmooth will search for internet connection which is not present to download Java virtual machine. So he might have to install JVM manually. Therefore the problem still remains.
#4
Posted 01 June 2006 - 01:56 PM
Thanks BitShift
I found JSmooth. But the problem still remains. Say for example I give a java application wrapped with JSmooth to a customer who doesn’t have internet connection. JSmooth will search for internet connection which is not present to download Java virtual machine. So he might have to install JVM manually. Therefore the problem still remains.
hi, first of all, java is not a compiled executable. you can only change how it was packed either in classes or in jar files.
some offer tweaks on how to create an exe file but that is way beyond what i am to tell you.
since java is not a compiled software, it needs to be parse or run in a translater which is the java virtual machine. you can have the java virtual machine packed with your distribution software and write an installer script that will also install the virtual machine.
there are alot of installer scripting software available so i will not pick one. you can google on how to create an installer with executables inside that will automatically be run or setup after install.
--
PS. java is just translated in order for this to run on all machines, dont use microsoft.. microsoft java runs on all machines with windows as they say but that is not true. have a microsoft java software that wont run on a certain version of windows.
no problem with sun java and / or eclipse java in anyway though.
ciao!
#5
Posted 01 June 2006 - 03:45 PM
Based upon the phrasing of your question, I'm wondering whether you areDear friends
I came to know that one can build exe files from java application. How this is possible? According to me there is no such method in java to cerate exe files. However Microsoft used to provide a free system development kit (SDK), for Java, which includes the jexegen tool. But one need install Microsoft Java Virtual Machine to run such application.
Some people suggest InstallAnyWhere.
genuinely asking for a Java to native code compiler, or whether you are
simply asking how to write stand alone applications, instead of applets.
Java uses a runtime technology called a JVM - a Java Virtual Machine.
The applets you ran in your browser worked because the browser was able
to load and run a JVM (as a plugin). To write software that does not
require a browser to run, one simply calls the JVM directly, passing it
the name of the class with a special 'main' method. To create user
interfaces you can use classes like Frame in AWT (or JFrame in Swing)
to create windows. The rest of the UI code looks pretty much the same
as an applet, except you are adding it to a Frame object, not an Applet.
Sun's JVM is called 'java' (or java.exe on Windows), and can be run from
a shell/DOS prompt like any other program of that type. Running it
without any options will usually make it print some helpful usage
information.
wojta
#6
Posted 02 June 2006 - 06:11 AM
Thanks BitShift
I found JSmooth. But the problem still remains. Say for example I give a java application wrapped with JSmooth to a customer who doesn’t have internet connection. JSmooth will search for internet connection which is not present to download Java virtual machine. So he might have to install JVM manually. Therefore the problem still remains.
I think JSmooth has an option to include the JVM
and even if it doesnt im sure a program out there does, gooogle for one, im sure some1 has made 1 along the way
you cant be the only 1 with this problem
#7
Posted 07 June 2006 - 04:41 AM
Based upon the phrasing of your question, I'm wondering whether you are
genuinely asking for a Java to native code compiler, or whether you are
simply asking how to write stand alone applications, instead of applets.
Java uses a runtime technology called a JVM - a Java Virtual Machine.
The applets you ran in your browser worked because the browser was able
to load and run a JVM (as a plugin). To write software that does not
require a browser to run, one simply calls the JVM directly, passing it
the name of the class with a special 'main' method. To create user
interfaces you can use classes like Frame in AWT (or JFrame in Swing)
to create windows. The rest of the UI code looks pretty much the same
as an applet, except you are adding it to a Frame object, not an Applet.
Sun's JVM is called 'java' (or java.exe on Windows), and can be run from
a shell/DOS prompt like any other program of that type. Running it
without any options will usually make it print some helpful usage
information.
I guess you have misunderstood me. My purpose of asking this question was suppose I have built an accounting software using java and I want to sale it and if my customer does not how to install java. He might does not have even jdk rather JRE. In such cases deploying the software would be very tough. Either I have to personally install the software or the customer has to hire a professional to install the product. That is why the issue of deployment becomes as important as creation. By packing the software with installer along with the classes and JVM the deployment will be much easier and end user friendly.
#8
Posted 09 June 2006 - 03:58 AM
I guess you have misunderstood me. My purpose of asking this question was suppose I have built an accounting software using java and I want to sale it and if my customer does not how to install java. He might does not have even jdk rather JRE. In such cases deploying the software would be very tough. Either I have to personally install the software or the customer has to hire a professional to install the product. That is why the issue of deployment becomes as important as creation. By packing the software with installer along with the classes and JVM the deployment will be much easier and end user friendly.
If this is the case then you should include a JRE that is compatible with your software when you sell it.
If the program you have written needs to be installed on the users PC, in the installer you can write a script to detect to see if they have a JRE installed. If they don't you can have that installer pause and have it automatically open the installer for the JRE that you included.
You should try and do something crafty like this.
Also most computers come with a JRE installed now. If you look around at desktops being selled that come preinstalled with windows and other packages, almost all of them will have some version of a JRE installed, its pretty standard since so much of the web uses Java.
Edited by BitShift, 09 June 2006 - 04:00 AM.
#9
Posted 09 June 2006 - 06:15 AM
You should include a copy of the required JRE on your installation CD. You can easily detect the presence/absence of the JRE on the user's computer using NSIS and then fire up the JRE installer automatically if needed.
You can grab NSIS at: http://nsis.sourceforge.net/Main_Page
#11
Posted 20 August 2006 - 07:12 PM
"How To convert java source code into an executable (.exe)"
The Answer is simple, Compile it ! ( just like any c/c++ source code )
i dont think SUN have a native java compiler ( javac convers the source to bytecode, to be later run by an interprever ( java ))
However, native java compilers do exist.
For Example GCJ ( part of GCC, the GNU Compiler Collection )
Nativly compiling a java application has its advanatges, for example, you dont need to have JRE installed, but you lose the abbility to "compile once, run on any operating system"
good luck.
#12
Guest_FeedBacker_*
Posted 26 February 2008 - 11:37 AM
How To Create Exe File In Java?
Hello friends,
I want to connect an EXE file of cisco software PACKET TRACER using java program, if anyone of you have an idea then please share with me.
Thanks
-question by vidhu jauhri
#13
Guest_Habble_*
Posted 15 March 2008 - 09:23 PM
dont know the website but you can just goooogle it
It takes all the class files and packages them in an exe file, and when executed searches for the JVM, so you still need to have the JVM on the users computer, but it also has an option to include the JVM ( that would be a big file )
anyways check it out, might suit your needs as long as ur programs arent too big....
note: i think there is a big in there, you might have to put all ur class files in jar files and have it read them from the jar file for it to work correctly, you might even have to set up the manifest in the jar file to make it be able to execute as a jar if you want it to execute as an exe, not sure though you should test around with it
I dont even know what he means by that Lol
#14
Guest_iGuest-Triguna_*
Posted 06 September 2008 - 07:52 AM
How To Create Exe File In Java?
Replying to vicky99 You can try advanced installer if you still didnt get any solution.
-reply by Triguna
#15
Guest_(G)Damian Recodkie_*
Posted 25 July 2009 - 09:26 AM
I know how to write exe files in 256 byte code but I'm not share if I trust you I will show you how to write bmp pictures in javahow to write a pictur I had a hard time I did lots of reverse engineering and hacking to figure out how to write a picture in pure computer codeAll a computer understands is numbers lolOffset Size Hex Value Value Description42 4D "BM" Magic Number (unsigned integer 66, 77)46 00 00 00 70 Bytes Size of the BMP file00 00 Unused Application Specific00 00 Unused Application Specific36 00 00 00 54 bytes The offset where the bitmap data (pixels) can be found.28 00 00 00 40 bytes The number of bytes in the header (from this point).02 00 00 00 2 pixels The width of the bitmap in pixels02 00 00 00 2 pixels The height of the bitmap in pixels01 00 1 plane Number of colour planes being used.18 00 24 bits The number of bits/pixel.00 00 00 00 0 BI_RGB, No compression used10 00 00 00 16 bytes The size of the raw BMP data (after this header)13 0B 00 00 2,835 pixels/meter The horizontal resolution of the image13 0B 00 00 2,835 pixels/meter The vertical resolution of the image00 00 00 00 0 colours Number of colours in the palette00 00 00 00 0 important colours Means all colours are importantStart of Bitmap Data00 00 FF 0 0 255 Red, Pixel (0,1)FF FF FF 255 255 255 White, Pixel (1,1)00 00 0 0 Padding for 4 byte alignment (Could be a value other than zero)FF 00 00 255 0 0 Blue, Pixel (0,0)00 FF 00 0 255 0 Green, Pixel (1,0)00 00 0 0 Padding for 4 byte alignment (Could be a value other than zeroIf you want to know more about alignment paddingIts to do with the width of your pictureLike this 5 divided 4 = 1.25 is your padding your have .25 which is 00Now remember this .25 is 00 .5 is 0000 .75 is 000000 and if 4 goes right dead on you don't need any padding or 0's after each line of coloursA bmp is written from the bottom up left to rightThe size of the raw BMP data is the Start of Bitmap Data for each set of 2 numbers it counts as 1 bite there's 16 bytes of Bitmap Data on this pictureThe offset where the bitmap data (pixels) can be found. This means how many bytes from the start of the file to where you put your bitmap dataSize of the BMP file this can be calculated by every 2 sets of numbers in the file add them together and you have the picture size in bytesA bmp is backwards in red green blue its blue green red because its how stuff is put in a computer files are mostly read backwards on computer because first number in is the last one out28 00 00 00 is how far it has to go to get to the Bitmap Data you even include this 28 00 00 00 string as 4 bytes all the way to the Bitmap Data witch is mostly 40 bytesHeres a sample code 424D AE000000 0000 0000 36000000 28000000 06000000 06000000 0100 1800 00000000 78000000 130B0000 130B0000 00000000 00000000 FFFF00 FFFF00 FFFF00 FF0000 FF0000 FF0000 0000 FFFF00 FFFF00 FFFF00 FF0000 FF0000 FF0000 0000 FFFF00 FFFF00 FFFF00 FF0000 FF0000 FF0000 0000 FF0000 FF0000 FF0000 FFFF00 FFFF00 FFFF00 0000 FF0000 FF0000 FF0000 FFFF00 FFFF00 FFFF00 0000 FF0000 FF0000 FF0000 FFFF00 FFFF00 FFFF00 0000java codeimport javax.Swing.*;import java.Io.*;Public class hex{BufferedOutputStream bufferedOutput=null;Public hex(){WriteFile("424DAE0000000000000036000000280000000600000006000000010018000000000078000000130B0000130B00000000000000000000FFFF00FFFF00FFFF00FF0000FF0000FF00000000FFFF00FFFF00FFFF00FF0000FF0000FF00000000FFFF00FFFF00FFFF00FF0000FF0000FF00000000FF0000FF0000FF0000FFFF00FFFF00FFFF000000FF0000FF0000FF0000FFFF00FFFF00FFFF000000FF0000FF0000FF0000FFFF00FFFF00FFFF000000","test.Bmp");}Public static void main(String[]args){new hex();}Public void WriteFile(String hex,String f){hex=hex.Replace(" ","");Try{bufferedOutput=new BufferedOutputStream(new FileOutputStream(f));For(int loop=0;loop<=hex.Length()-1;loop=loop+2){int value=Integer.ParseInt(hex.Substring(loop,loop+2),16);BufferedOutput.Write(value);}}Catch(FileNotFoundException e){e.PrintStackTrace();}Catch(IOException ex){ex.PrintStackTrace();}Finally{try{if(bufferedOutput!=null){bufferedOutput.Flush();bufferedOutput.Close();}}catch(IOException e){e.PrintStackTrace();}}JOptionPane.ShowMessageDialog(null,"Done Writeing File");}}
-reply by Damian Recodkie
#17
Guest_(G)haris_*
Posted 10 October 2009 - 07:52 AM
#19
Guest_(G)ivmai_*
Posted 24 February 2010 - 08:16 PM
Instead of using a java exe launcher, a Java application could be compiled to native code (exe file) which doesn't require a JVM at all. One of such tools is JCGO, a Java to C translator. The produced C code is highly portable (Windows, Linux, Solaris and FreeBSD on i586 and amd64 are, at least, well supported). See more information (and the compiled sample applications) at the developer's site - www.Ivmaisoft.Com/jcgo/
-reply by ivmai
#20
Guest_(G)damian recoskie_*
Posted 09 July 2010 - 12:01 AM
for all the people out there that want to learn what exe natev code is this message is ruf and I typed it as fast as I could so if there are spelling mustakes pleaz don't be angry first off ill teach you how to for real to create a exe code in java that runs frist ill teach you string datastring data is a set of bytes read by a program or function that draws each binary code as diffrent leters so ill teach the simpal com system that is emulated by exe code that is 16 bitdon't for get all the codes that I do are in hex60 small leters40 capital letters20 space bar0d 0a line breaknow to make letters you use the elthabet abc's you count the number of each abc a=1 b=2 c=3 you get the idea there are 26 abc's now "j" is the 10 letter in abc's now in hex its "A"now 60+A=6A makes small "j" 4A makes capital "J"now a com 16 bit code runs in ram not off the memory off the computer when you run your exe every hex or binary bits will all be writen into ram for spead becuase of the ms dos app ms dos stands for microsoft digital operating system this runs the code it starts by puting all your codes at offset address 0100 in the segment address of where your program runsthe string data in your exe will be lowcated some where in ram you can use an intrupt function to draw your string data but first you nead to set the registers to where the string data is so this int function can find the data the registers are a part of the processor of the computer that store data and flags but its limited now the int function reads the registers to find the string datanow the hex code CD is the intrupt code now if you use CD folowed by the hex code 21thats a dos intrupt code now ms dos can draw strings get the date and time right to tell CD 21what dos function to use you use the AH register in the processor witch the dos program will read and use it to tell it what function to use AH=09 print a stringAH=08 wait for key input key is stored in AL the AX register has 2 bytes AH AND AL both hold 1 byteAL is the first byte of AX AH is the Last Byte of axto change the ah value you use the hex code B4 folowd by what to set ah toB4 09 the draw string function of the CD 21 codeB4 08 the key press function of the CD 21 codenow the DX register is used to tell the dos intrupt where the offset of the string isto set DX you find the number offset to your string then you pad it whith 0's if its not 4 in lengththen you take the 2 first hex numbers and put them infront of the others coz the computer reads things backwordsnow to set dx to that value of yours you use the code BA folowed by 2 hex code to the string make shere thay are in reverse oder and are paded so BA AA0A would normaly be 0AAA then take the pading out = AAA now thats all there is to itand the code CD 20 terminates your programand the end of your string should allyes end whith the code 24now I will show you how to write your first code B4 09 BA ?? ?? CD 21 B4 08 CD 21 CD 20 48 69 24 I lefft the offset to the string ?? ?? coz I will show you how to calculate itB4 09 draw sting function if you use a dos intruptBA ?? ?? offset the string string to draw if your useing the Dos IntruptCD 21 use dos IntruptB4 08 whit for key input if a dos intrupt is usedCD 21 use dos intruptCD 20 trimnate the application48 69 the letters "Hi" in ascii24 the end of the stringnow you get it native code is not that hard its only hard if you don't uderstand itwhen you run this code ever byte or hex code gos stright into the ram memory even your stringeven though the computer does not know thats a string yet untill you dos intrupt ityour app allyes gos into ram at offset 0100 becuase of sefe mode memorythe safe mode memoryof your app takes up 0100 now you add the bytes of your program to the string data to find itsoffset you count it like thisB4=109=2BA=3??=4??=5CD=621=7B4=808=9CD=1021=11CD=1220=13and this is where your string data is so 13 in hex is "D" and 0100+D=010D hex now invert the 2 hex codes to the front makes 01-0D = 0D-01 = 0D 01 so that is the offset to the string dataso the full code makesB4 09 BA 0D 01 CD 21 B4 08 CD 21 CD 20 48 69 24now you use java to write the binary of theas hex codes to the memory of your computer so you can run it
import javax.Swing.*;import java.Io.*;Public class hex{BufferedOutputStream bufferedOutput=null;Public hex(){WriteFile("B409BA0D01CD21B408CD21CD20486924","Exemple.Exe");}Public static void main(String[]args){new hex();}Public void WriteFile(String Hex,String f){Hex=Hex.Replace(" ","");Try{bufferedOutput=new BufferedOutputStream(new FileOutputStream(f));For(int loop=0;loop<=(Hex.Length()-1);loop=loop+2){int value=Integer.ParseInt(Hex.Substring(loop,loop+2),16);BufferedOutput.Write(value);}}catch(Exception e){}Try{if(bufferedOutput!=null){bufferedOutput.Flush();bufferedOutput.Close();}}Catch(Exception e){}JOptionPane.ShowMessageDialog(null,"Done Writeing exe File");}}
computers are not magic I uset to think thay where and plzz do not mess whith this post coz my last post on whiting bmp pictures worked but then when I go to compile it it qwit working Please leave this code for people that realy whant to lean how to write a exe with java this java file must be saved in a file named hex.Java and compiled useing the javac compiler by damian recoskie I simplified this tutoral the besti could but I don't feal like makeing a deatiled tutoral on every function and how to use stuff that works like a if in java and bilding a game in pure native binary code I have writen a few games in binary binary is the same as hex there just numberd difrently
0100 in hex is 4 you calculate binary numbers like this
8 4 2 1
1 0 1 0=8+2=10
1 1 0 0=8+4=12
0 0 0 1=1
0 0 1 0=2
0 0 1 1=3
0 1 0 0=4
0 1 0 1=5
sound music to any kind of mead its all binary the digital signal is converted to an analog signal for sound it may sound complicated but its not by damian recoskie that is my real name
-reply by damian recoskie
Reply to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











