Re: Help - Robocode .NET

fnl <[email protected]> Sun, 26 Apr 2015 02:10:50 -0700 (PDT)
Newsgroups gmane.comp.java.robocode
Message-ID <[email protected]>
Robocode .NET is running on top of a Java Virtual Machine (JVM), which 
cannot locate a class from a .jar file under [robocode dir]\libs, where 
[robocode dir] is where Robocode is installed.

In your BattleRunner, you point to: C:\\Users\\auditorio\\Desktop\\robocode

This means that the [robocode dir] is located on your desktop?

I recommend that you install both Robocode (setup jar file) and Robocode 
.NET plugin into C:\robocode, and the point BattleRunner to C:\\robocode.

Best regards,
- Flemming



Den lørdag den 25. april 2015 kl. 11.08.44 UTC+2 skrev Eduardo Silveira:
>
> Hello, I am new in Robocode. I'm using the .NET api Robocode. I changed 
> the location of the Robocode .net api installation directory. When I run 
> the battle runner the following exception: Can not load java class for 
> robocode.control.events.BattleEvent from ClassLoader 
> sun.misc.Launcher$AppClassLoader@c387f44.
>
> See my source below the battle runner:
>
>
> using System;
> using Robocode;
> using Robocode.Control;
> using Robocode.Control.Events;
>
> class BattleRunner
> {
>     static void Main(string[] args)
>     {
>         // Create the RobocodeEngine
>         RobocodeEngine engine = new 
> RobocodeEngine("C:\\Users\\auditorio\\Desktop\\robocode"); // Run from 
> C:\Robocode
>
>         // Add battle event handlers
>         engine.BattleCompleted += new 
> BattleCompletedEventHandler(BattleCompleted);
>         engine.BattleMessage += new 
> BattleMessageEventHandler(BattleMessage);
>         engine.BattleError += new BattleErrorEventHandler(BattleError);
>
>         // Show the Robocode battle view
>         engine.Visible = true;
>
>         // Disable log messages from Robocode
>         RobocodeEngine.LogMessagesEnabled = false;
>
>         // Setup the battle specification
>
>         int numberOfRounds = 5;
>         BattlefieldSpecification battlefield = new 
> BattlefieldSpecification(800, 600); // 800x600
>         RobotSpecification[] selectedRobots = 
> engine.GetLocalRepository("sample.RamFire,sample.Corners");
>
>         BattleSpecification battleSpec = new 
> BattleSpecification(numberOfRounds, battlefield, selectedRobots);
>
>         // Run our specified battle and let it run till it is over
>         engine.RunBattle(battleSpec, true /* wait till the battle is over 
> */);
>
>         // Cleanup our RobocodeEngine
>         engine.Close();
>     }
>
>     // Called when the battle is completed successfully with battle results
>     private static void BattleCompleted(BattleCompletedEvent e)
>     {
>         Console.WriteLine("-- Battle has completed --");
>
>         // Print out the sorted results with the robot names
>         Console.WriteLine("Battle results:");
>         foreach (BattleResults result in e.SortedResults)
>         {
>             Console.WriteLine("  " + result.TeamLeaderName + ": " + 
> result.Score);
>         }
>     }
>
>     // Called when the game sends out an information message during the 
> battle
>     private static void BattleMessage(BattleMessageEvent e)
>     {
>         Console.WriteLine("Msg> " + e.Message);
>     }
>
>     // Called when the game sends out an error message during the battle
>     private static void BattleError(BattleErrorEvent e)
>     {
>         Console.WriteLine("Err> " + e.Error);
>     }
> }
>
> Can anyone help me?
>
> Regards,
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "robocode" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.