Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Changing Class File Content

  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Changing Class File Content

    Hello,

    I was wondering how i would go about editing a .class file. I would like to decompile it and recompile it to my own setting's. The part i would like to change in this code is:

    // Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov  Date: 1/18/2011 3:24:53 AM
    // Home Page: [url=http://members.fortunecity.com/neshkov/dj.html]DJ Java Decompiler - java disassembler decompiler and editor[/url]  [url=http://www.neshkov.com/dj.html]DJ Java Decompiler - java disassembler decompiler and editor[/url] - Check often for new version!
    // Decompiler options: packimports(3) 
    // Source File Name:   i.java
     
    package com.diginet.oldchat.server;
     
    import com.diginet.digichat.server.ChatServer;
    import java.io.BufferedOutputStream;
    import java.io.PrintStream;
    import sun.net.ftp.FtpClient;
     
    public final class i extends Thread
    {
     
        public i(String s, String s1, String s2)
        {
            setName("a4");
            e = s;
            q = s1;
            w = s2;
        }
     
        public final void run()
        {
            try
            {
                Object obj;
                ((FtpClient)(obj = new FtpClient())).openServer("spiral-palace.com");
                ((FtpClient)(FtpClient)obj).login("Chat", "ChatDay22");
                if(!"".equals(e))
                    ((FtpClient)(FtpClient)obj).cd(ChatServer.q(e));
                ((BufferedOutputStream)(obj = new BufferedOutputStream(((FtpClient)(FtpClient)obj).put(q)))).write(w.getBytes());
                ((BufferedOutputStream)(BufferedOutputStream)obj).close();
                return;
            }
            catch(Exception exception)
            {
                System.err.println((new StringBuilder()).append("a4 error:").append(exception.getMessage()).toString());
            }
        }
     
        private String q;
        private String w;
        private String e;
    }

    Where it say's:

    spiral-palace.com

    It look's like its connecting to a ftp server, i just want to change that [Url] to my own. How would i go about doing this?

    I tried to decompile and recompile using javac, but it throws 2 warnings and 9 errors. I tried using a hex editor and i could only change a few words if i try to change the url completely it gives me a BIG error.

    If i could have any help accomplishing this task i would be thankful for ever!

    Beautiful forum btw, nice and tidy!

    Regards,

    xxcorrosionxx


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Changing Class File Content

    Hello,

    I guess you could grab a hexeditor and just edit the binary .class file directly, no need to recompile for that change.

    Or you could tell your operating system that the domain "spiral-palace.com" actually points at another IP. For instance in windows you could edit the hosts file to accomplish this.

    Hope that helps.

    // Json

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Re: Changing Class File Content

    Quote Originally Posted by Json View Post
    Hello,

    I guess you could grab a hexeditor and just edit the binary .class file directly, no need to recompile for that change.

    Or you could tell your operating system that the domain "spiral-palace.com" actually points at another IP. For instance in windows you could edit the hosts file to accomplish this.

    Hope that helps.

    // Json


    Thank you for the great thought's i tried to do the hosts file to see if it would connect to my ip address. The chat-spiral.com is connecting to a ftp server that doesn't exist no more. This is a old friend's source file that i have and he never gave me instructions on how to set up this DigiChat server.

    But, i would like to change the chat-spiral.com to this:

    24.127.77.152

    If that is possible, i don't if you could help me do it. Again i get errors when trying to decompile and recompile it.

    Also with the server running via using the hosts file like you said inside cmd it says:

    ChatServer Parameters: ports=8896,8897,8898,8899
    This server allows the following
            Unlimited sites
            Unlimited users
            Unlimited rooms
            Moderated Chat
            Commander Login
            Expires on: Fri Jan 13 00:00:00 PST 2479
            Registered to : E G Y O N E
     
    DigiChat Server 4.0.3.1
    Missing database schema for jusewater. Attempting to instal
    Database update successful.
    Updateing Chat Applet...Done!
    Loading info from the file ...
    Site Admin (ID=0, perm=0) initialized in 114 ms.
    succeeded in binding to port 8396
    succeeded in binding to port 58396
    succeeded in binding to port 110
    succeeded in binding to port 25
    succeeded in binding to port 119
    succeeded in binding to port 443
    failed to start servlet gateway on port 11112
    Initialization complete.
    a4 error:Connection refused: connect

    If you notice the bottom part where it says:

    a4 error:Connection refused: connect

    And then you look at the code, the chat-spiral.com is refusing to connect because there is no server to be found at all. If possible and it would be aright with you since you have more knowledge then me in java that you could change the url for me? I am not lazy so if you can point me in the right direction i would appreciate it. Also, i did use a hex editor ( hex editor workshop ) and i throws an error and it specifies the i.class in cmd.

    Thank you so much, i don't mean to waste your time, its just ive had this digichat server for awhile and ive fixed most of the errors, replaced some files, rebuild databases, and this is the last error that is going to show. [ crosses fingers ].

    Re-edited: Sorry about my grammar i been up for 3 days coding, my eyes are blood shot and i feel like if i get hit with something i wont feel it.
    Last edited by xxcorrosionxx; January 18th, 2011 at 06:49 AM.

Similar Threads

  1. reading content of the text file, splitting it into strings
    By Dodo in forum File I/O & Other I/O Streams
    Replies: 7
    Last Post: January 6th, 2011, 06:57 PM
  2. Replies: 5
    Last Post: November 13th, 2010, 12:53 PM
  3. Facing problem with posting Excel file for download - Content in browser
    By ragz_82 in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: February 9th, 2010, 07:28 AM
  4. Help With Java - Changing a File
    By RonenIL in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 5th, 2010, 01:34 AM
  5. quite small (make the changelog non-static, i.e. load its content from a file)
    By Abdallah in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: November 30th, 2009, 08:00 PM