• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I don't know how to describe this with only a few words

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Robocode, which is a robotics battle simulator, the user can program a robot using java, and then use it in a battle. The robot must extends Robot class, and the user can select to use it for a battle in the robocode program.

How do they do this? because in order to use the robot, the code would have to reference it in it's own code. But the Robocode program is already compiled, it can't change the source code of itself... and yet if you write a class that extends robot you can use it in the program as if the Robocode program has a reference to it in itself... I don't know how to describe this in one or two words... but hopefully you know what I mean.

I want to do something similar with my program, where the user can program something and use it in my program.
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's basically a plugin API.
Conveniently, a JavaRanch journal entry that covers this topic was posted a few years ago: http://www.javaranch.com/journal/200607/Plugins.html
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I loved Robocode :)
 
Daniel Gen Li
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much. I'll look through it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic