jave to exe


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: jave to exe

  1. #1
    Join Date
    May 2004
    Posts
    29

    jave to exe

    hi. can anyone plz give me a link to a free prg that allows you to turn ur java code into exe? i'd rather not use jar files cuz ppl can still get my code. and besides, i dont have much experience with jar files anywyz.
    thank you

  2. #2
    Join Date
    May 2004
    Posts
    219
    You can't.

  3. #3
    Join Date
    May 2004
    Posts
    26
    I don't know about any programs, but I am pretty sure you can. However, any kind of executable (exe, bat, sh) would still have to make a call to 'java YourMainClass'

    Also, why do you say that if you give jar files they can get access to your code????

  4. #4
    Join Date
    May 2004
    Posts
    26
    Here's one tool Dunno if it's free.

    http://www.duckware.com/jexepack/

  5. #5
    Join Date
    May 2004
    Posts
    29
    well this is going to be embarrising. see, what i know about jar is that it's a zip file and can execute some code i write. so what's to stop a user from extracting the jar file and checking the code?

  6. #6
    Join Date
    May 2004
    Posts
    219
    Jars are just a convenient way to store all your .class files into one file. Yes anyone can remove your class files and perhaps decompile them. That EXE pack program is probably what you're looking for, although I suspect that all it does is temporarily extract the .class files and run them normally.

  7. #7
    Join Date
    May 2004
    Posts
    29
    am starting to pull my hair i have an X.java and X.class files in my NEW FOLDER in desktop.
    i went to comp props, advanced, env variables and clicked new. it's the top one. i wrote PATH for name and C:\j2sdk1.4.2_03\ as the path. then i went to cmd prompt and went to my new folder in desktop. should be something like this: C:\Documents and Settings\Tareq.T\Desktop\New Folder. i typed jar cf nameoffile file/s
    nameoffile: name of jar file. choose any name u want
    file/s: the file/s that you would like to jar with a space
    between each file
    so in my case, i typed:-
    jar cf x x.class x.java
    the icon that was created in my NEW FOLDER was a white one. you know, the one where when you double click on it, it'll tell u that it cant find the app to open to this prg so either go to web to get the app or choose suitable prg from list. so i did that. then i went to C:\j2sdk1.4.2_03\bin and chose a javaw then i clicked okay and i got this error:
    failed to load Main-Class manifest attribute from C:\Documents and Settings\Tareq.T\Desktop\New Folder\x
    the env variable that i made gave me an idea. so i placed x.class and x.java in C:\j2sdk1.4.2_03\bin then i went to cmd prompt, went to C:\j2sdk1.4.2_03\bin and typed jar cf x x.java x.class
    same result. nothing changed. i looked around on the internet but found now answer. oh, and btw, the icons of jar files that i found on the net while doing my search were either the same ones as word doc or quiet similar to it. in other words, the icons were different.
    HELP!!!

  8. #8
    Join Date
    Nov 2003
    Posts
    22
    if you're feeling a little adventurous gcc (the gnu compiler collection, which is licensed under the GPL) has had java support included for quite some time now I think

  9. #9
    Join Date
    May 2004
    Posts
    29
    ya i checked it out a few days ago. but u see, the prb with me is that i need to know about jar files so that i can move on. i cant just leave it like this and then move on to something else. i gotta know why my jar files wont work. i gotta b able to use em to their fullest extent and control em all i like. so am kinda stuck now at thinking of why is it that i cant get it to work? check previous post

  10. #10
    Join Date
    Jun 2004
    Posts
    14
    You can use any zip utility you like to create jar files. To run them, you need to make a manifest file (META-INF/MANIFEST.MF). You specify the main class in here, then you can just double-click to run.

  11. #11
    Join Date
    May 2004
    Posts
    29
    okay can someone tell me the exact steps to create a jar file? cuz i dont know how to create a meta file. i thought that these were created with the jar file? nywyz, to stop any further confusion from arising, can someone plz tell me the exact steps to create jar files?
    and i wana create them myself. not use any prgs
    thanx

  12. #12
    Join Date
    Jun 2004
    Posts
    14
    A jar file is just a zip file ending with '.jar'.
    Here's a manifest file:
    Code:
    Manifest-Version: 1.0
    Main-Class: Shapes
    Created-By: aaa
    'Shapes' is the class with the main method.
    Create the manifest file using a text editor. Change the MainClass to your main class. Save it as 'manifest.mf' (make sure no '.txt' is added). Then create a folder. Put your java class files in there. In that folder create another folder called 'meta-inf'. Put 'manifest.mf' in there. Then highlight everything and put that highlighted stuff in a zip file. Rename it so it ends in '.jar'.

  13. #13
    Join Date
    May 2004
    Posts
    29
    IT WORKED!!!! THANK YOU SOOO MUCH
    if i knew that i had to do everythign myself, life would have been much easier. i thought that i'd learn the jar commands so that i can benifit but it turned against me : (
    thanx again

  14. #14
    Join Date
    Feb 2004
    Posts
    808

    Re: jave to exe

    Originally posted by Wild Heart
    hi. can anyone plz give me a link to a free prg that allows you to turn ur java code into exe?

    you cant. java is intended as a program that can run on any platform. this means to turn it into an exe makes it windows only, which is against the whole idea. if you really think your windows-only code is worth protecting, write it in VB

    i'd rather not use jar files cuz ppl can still get my code.
    that's what obfuscation is for


    and besides, i dont have much experience with jar files anywyz.
    thank you
    i have a link in my signature that will tell you nearly everything you want to know
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

  15. #15
    Join Date
    Feb 2004
    Posts
    808
    Originally posted by Wild Heart
    IT WORKED!!!! THANK YOU SOOO MUCH
    if i knew that i had to do everythign myself, life would have been much easier. i thought that i'd learn the jar commands so that i can benifit but it turned against me : (
    thanx again
    you dont have to do everything yourself.. read the tutorial in my signature
    The 6th edict:
    "A thing of reference thing can hold either a null thing or a thing to any thing whose thing is assignment compatible with the thing of the thing" - ArchAngel, www.dictionary.com et al.
    JAR tutorial GridBag tutorial Inherited Shapes Inheritance? String.split(); FTP?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center