package org.perl6.rakudo;

import org.perl6.nqp.tools.EvalServer;

public class RakudoEvalServer extends EvalServer {

    private String appname = null;

    public String run(String code) throws Exception {
        return super.run(appname, code);
    }

    public String run(String[] argv) throws Exception {
        return super.run(appname, argv);
    }

    public RakudoEvalServer() {
        String[] cps = System.getProperty("java.class.path").split("[;:]");
        for(String cfile : cps) {
            if(cfile.endsWith("perl6.jar")) {
                appname = cfile;
                break;
            }
        }
        if(appname == null) {
            throw new RuntimeException("CLASSPATH not set properly, couldn't find perl6.jar");
        }

        System.setProperty("perl6.prefix", appname.substring(0, appname.indexOf("/languages")));
        System.setProperty("perl6.execname", "RakudoEvalServer");
    }
}

@@ -346,32 +346,408 @@
 , argv);%0A    %7D%0A%0A
+    /*%0A        Neccessary elements in the CLASSPATH are as follows:%0A%0A        $P6_INSTALL_PREFIX/languages/nqp/lib%0A        $P6_INSTALL_PREFIX/languages/nqp/runtime/*%0A        $P6_INSTALL_PREFIX/languages/perl6/lib%0A        $P6_INSTALL_PREFIX/languages/perl6/lib/Perl6%0A        $P6_INSTALL_PREFIX/languages/perl6/runtime%0A        $P6_INSTALL_PREFIX/languages/perl6/runtime/*%0A    */%0A
     public Rakud

Document neccessary CLASSPATH entries.