ANT, path building and more for java
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Javier_Ortiz
Posted On:   Sunday, February 13, 2005 12:59 PM

I'm building a web wrestling-based online game in Java (more on that later) and I have some questions that I haven't figured out yet. They may look logical answers but I'm learning Java on the way so please help me on the following: Local folder: I want to know how to write the path where you are actually working. Like if you are running a code in folder C:some path/code folder/code.java a code to refer to that place. So if anyone else has the code "installed" in other place it still finds it. Something like "[special char]/code folder" so it can be found in both cases. Dinamic code: I have a class that basically read names from a txt file and depending on what it reads it opens a class    More>>


I'm building a web wrestling-based online game in Java (more on that later) and I have some questions that I haven't figured out yet. They may look logical answers but I'm learning Java on the way so please help me on the following:



  • Local folder: I want to know how to write the path where you are actually working. Like if you are running a code in folder C:some path/code folder/code.java a code to refer to that place. So if anyone else has the code "installed" in other place it still finds it. Something like "[special char]/code folder" so it can be found in both cases.



  • Dinamic code: I have a class that basically read names from a txt file and depending on what it reads it opens a class with that name. Basically is a deck builder based on a txt formatted text.


  • Here's the code:

    			
    private void createPage(BufferedReader pages)
    {
    int quantity=0;
    try{
    String page="";
    while((page=pages.readLine())!=null)
    {
    if(page.equals("Chris Jericho Second Edition"))
    {
    this.SS=new Y2J();
    this.SS.update();
    }
    if(page.equals("Test First Edition"))
    {
    this.SS=new Test();
    this.SS.update();
    }
    if(page.equals("Agility First Edition"))
    {
    this.addPage(new Agility(),quantity);
    quantity++;
    }
    if(page.equals("Strenght First Edition"))
    {
    this.addPage(new Strength(),quantity);
    quantity++;
    }
    if(page.equals("Knowledge First Edition"))
    {
    this.addPage(new Knowledge(),quantity);
    quantity++;
    }
    if(page.equals("Strike First Edition"))
    {
    this.addPage(new Strike(),quantity);
    quantity++;
    }
    if(page.equals("Technical First Edition"))
    {
    this.addPage(new Technical(),quantity);
    quantity++;
    }
    if(page.equals("Punch First Edition"))
    {
    this.addPage(new Punch(),quantity);
    quantity++;
    }
    if(page.equals("Vertical Suplex First Edition"))
    {
    this.addPage(new VerticalSuplex(),quantity);
    quantity++;
    }
    if(page.equals("Flat of the foot TLC Edition"))
    {
    this.addPage(new Flat_of_the_foot(),quantity);
    quantity++;
    }
    }
    }
    catch (IOException e1) {
    System.out.println("IO problem: "+ e1);
    e1.printStackTrace();
    }
    }


    The code works wonders but as you might already noticed the problem arises when the "page" quantity is to be 2000+. If the "pages" will be in the same folder (only files on that folder), is tere a way to make a code loop thru the folder's file names and create a new instance of the java class with the specified name?


  • Sound/video playing: Mostly examples to do this in java.



  • ANT: I want avoid people from reading the code when the game's deployed and so far ANT looks like the only solution to this issue but I have problems with the ANT script, no examples/tutorials so far. Maybe I don't know where to look or someone out there reading this has a better idea. Basically if that's way too complicated a way to encrypt the code and decode it when compiling (what I think ANT does :P).


  • If by any chance anyone is interested in the Wrestling game please let me know so I can send link to page and current game I'm working on and where it came from.

    Thanks in advance

    JD

       <<Less
    About | Sitemap | Contact