Results 1 to 4 of 4
  1. #1
    coco is offline Member
    Join Date
    Jul 2007
    Rep Power

    Default Help with bytecode in java

    Hi, I am wondering if there is an alternative to distributing Java programs with the JVM.

    For instance, I am wondering if anyone has seen a Java compiler that produces machine code rather than bytecode? I've heard of them, but never ever seen them.
    Alternatively, what is the easiest way to make the Java class file seem 'executable'. My Current approach is to use a bat file (or shell script). With the bat file I simply associate my .class files with it and I can then run it by double-clicking the class file containing my main method.

    However, some people find this a bit confusing since they are not used to running .class files. Is there a better way of achieving this?

  2. #2
    toby is offline Member
    Join Date
    Jul 2007
    Rep Power


    If you are supporting Windows, look into converting the program into a .exe file. I can't remember the process exactly(and I'm not at my PC), but a search in java forums(like SUN or another java forum) should point you in the direction.

  3. #3
    Join Date
    Apr 2009
    Rep Power

    Default Watermark in java class file


    I would like to know how to embed watermark in Java class file and decode that watermark class file to get back the watermark value.

    I will be appreciate if any one can provide the source code.

    I'hv tried many time to get the bytecode of the class file to embed the watermark value but failed. Should i used the class reader to read the class file but where i must to called the class file and how.

    I include some code that i don't know where to get my .class inside this code:

    package test;

    import javax.swing.JOptionPane;

    public class ClassLocationTest {
    public static void main(String[] args) {
    JOptionPane.showMessageDialog(null, getClassLocation(String.class));

    public static String getClassLocation(final Class<?> pClass) {
    final String location, name;
    name = pClass.getName().replaceAll("\\.", "/") + ".class";
    location = ClassLoader.getSystemResource(name).getPath();
    return location;

    I hope any one can help me immediately because i must to submit it next week.

    Thanks you

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    New Zealand
    Rep Power


    Multiposted in various ancient unrelated threads.

    @nur_az2206bad: try again showing a bit of common sense. Start your own thread for your own question. Post it exactly once. And recognise that any urgency is yours and no problem of any one else's.

Similar Threads

  1. differences between bytecode and executable code
    By valery in forum New To Java
    Replies: 2
    Last Post: 04-16-2009, 08:13 AM

Posting Permissions

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