Results 1 to 6 of 6
  1. #1
    satheeshtech is offline Member
    Join Date
    Jul 2009
    Posts
    18
    Rep Power
    0

    Default converting java class file to exe file

    HI all,

    is there any simple way to convert java class file to exe file? pls sugges me

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    There is no easy way to 'convert' it. A java class file requires the java virtual machine (JVM) to run, so there isn't enough information in a class file to simple make it an exe.

    It is possible to compile java code as native code, but this makes it platform dependent.

    Its also possible to bundle a java file inside a package and launch it with a script. You could try making a windows .bat (batch file, I assume you use windows). If on unix, you can make a simple shell script that can act as a launcher, and if you are on the mac (the unix way works here too, since MacOS is unix) you can use an app called platypus to turn your app into an application bundle.

    The simplest method is to simply put the .class into a jar file, which is double-clickable on any platform with the JVM installed.

  3. #3
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    put class in jar file and double click it cant work,

    read
    How to create Setup for java application
    useful link found at post #5

  4. #4
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    To mtyoung: I don't really know what that post means, the link you sent talks about embedding a local database in a jar, which has nothing to do with this posters question. Embedding a class in a jar will work depending on application- what do you think is in a jar? A collection of class files and associated files. So using the java jar utility and assuming there is a main method, a jar would produce a nice double clickable app.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by quad64bit View Post
    ...the link you sent talks about embedding a local database in a jar, which has nothing to do with this posters question. ...
    We must be reading different links here. This is the link that I got out of mtyoung's post: Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment)

    which talks about creating JAR files in general, something very appropriate for the original poster to read.

  6. #6
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    I'm sorry, in the email copy of his post, a totally different link was attached :).

Similar Threads

  1. converting jar to .class or .java
    By marmara95 in forum New To Java
    Replies: 12
    Last Post: 10-06-2012, 10:49 PM
  2. Converting a text file int binary
    By sruthi_2009 in forum New To Java
    Replies: 0
    Last Post: 03-23-2009, 03:09 PM
  3. .class file to .java file
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 02-20-2009, 06:46 PM
  4. Error while converting trace file to readable txt
    By suresh in forum Forum Lobby
    Replies: 1
    Last Post: 12-04-2008, 07:31 AM
  5. Converting text file(.txt) to JPG file(.jpg) in java
    By javadeveloper in forum Advanced Java
    Replies: 0
    Last Post: 11-09-2007, 04:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •