Results 1 to 6 of 6

Thread: Giving a friend a class wont work!

  1. #1

    Thread Starter
    Addicted Member NOMADMAN's Avatar
    Join Date
    Aug 2002
    Location
    Closer than you think
    Posts
    237

    Giving a friend a class wont work!

    I had a project game for a class of mine where the teacher gave us students a very large portion of the program as a few class files. I finished the project and turned it in and one of my friends wants the game to play. I sent him the class files (all freshly compiled) and he couldn't run them from the dos prompt. I'm winME and hes win98 hes got java version 1.4.1_XXb I don't remember the Xs and myself java v.build 1.4.1_01-b01. I've also seen the JVM on his comp... whats up?

    What should I do to try and solve this? I can't make it an applet (best solution) because I don't have the .java files for 75% of the program. If I could just make the program stand alone or something! Anyone?!

    Thanks,

    NOMAD

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Not sure if i follow. Your teacher gave you a bunch of classes which where a portion of a larger program. Now when you say you finished the project and handed it in. What did you have to do? Extend and add additional functionality to existing classes? Now what portion of the program does your friend have? Also when he tries to run the program from the DOS prompt what happens?

    It seems like you have the entire program compiled but you lack the .java files to turn the program into an applet. Would this be correct to say? If that is the case you can open up any .class files that you have in JBuilder and it will decompile them for you.

    For instance opening up a .class file in JBuilder such as......
    Code:
    import java.util.*; 
    
     class FortKnox{
     public static void main(String[] args){
       String s = "bronze silver gold "; 
       StringTokenizer st = new StringTokenizer(s); 
       String[] vault = new String[3]; 
       int index = -1; 
    
       while(st.hasMoreTokens()){
          String token = st.nextToken(); 
           vault[++index] = token; 
        }
        openVault(vault);
      }
       public static void openVault(String[] vault){
        System.out.print("The contents of the vault are");
         System.out.println(); 
         for(int i = 0; i < vault.length; i++){
           System.out.println(vault[i]);
       }   
      }
    will produce the following.........
    Code:
    // JBuilder API Decompiler stub source generated from class file
    // Feb 22, 2003
    // -- implementation of methods is not available
    
    // Imports
    import java.lang.String;
    
    class FortKnox {
    
      // Constructors
      FortKnox() { }
    
      // Methods
      public static void main(String[] p0) { }
      public static void openVault(String[] p0) { }
    }

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    And there are actual java decompilers.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Addicted Member NOMADMAN's Avatar
    Join Date
    Aug 2002
    Location
    Closer than you think
    Posts
    237
    Dilenger 4:
    "Your teacher gave you a bunch of classes which where a portion of a larger program. Now when you say you finished the project and handed it in. What did you have to do? Extend and add additional functionality to existing classes?"
    Yes

    "Now what portion of the program does your friend have?"
    Only what I have, about 8 .class (3 of 8 are same are .java) files and 3 .java files

    "Also when he tries to run the program from the DOS prompt what happens?"
    Exception in thread "main" java.lang.NoClassDefFoundError:

    No Jbuilder, but I'll search for one. After I get all them in java form I'll just make it a applet or something, thanks guys!

    NOMAD

    PS: so what does this decompiling do to closed sorce code, besides making it open? Why did they make it decompilable?

  5. #5

    Thread Starter
    Addicted Member NOMADMAN's Avatar
    Join Date
    Aug 2002
    Location
    Closer than you think
    Posts
    237
    Got one, DJ*something* and I changed it to an applet and it works all good! Thanks guys!

    NOMAD

  6. #6

Posting Permissions

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



Click Here to Expand Forum to Full Width