S
Sevenson76
Gast
Ich kann Showdown.java kompilieren, aber ich kann die Datei nicht ausführen.
Ich bin Anfänger in Java und habe mir hier die JAR-Datei und Quellcode heruntergeladen von Stevebecher:
brecware Software
Wenn ich auf die BAT-Datei klicke, funktioniert alles - das DOS-Fenster öffnet sich, und man kann seine Eingaben machen.
In der BAT-Datei steht nur @java -jar HoldemShowdown.jar
In den Metadaten - „META-INF/MANIFEST.MF“ - in der JAR-Datei steht:
Manifest-Version: 1.0
Sealed: true
Main-Class: com.stevebrecher.showdown.Showdown
Daher ging ich davon aus, dass Showdown.java die auszuführende Datei ist. Dort habe ich dann auch die main-Methode gefunden.
Aber egal wo ich Showdown.java kompiliere, ich kann die Datei nicht ausführen.
Wenn die JAR-Datei: HoldEmShowdown.jar entpackt ist, sieht das wie folgt aus:
HoldEmShowdown\com\stevebrecher\poker
enthält
Card.java, CardSet.java, HandEval.java
und
HoldEmShowdown\com\stevebrecher\showdown
enthält
Enumerator.java, Help.java, Output.java, Showdown.java, UserInput
Wenn ich Showdown.java in dem Ordner showdown kompileren möchte, bekomme ich die Fehler ausgegeben:
Daraufhin habe ich Showdown.java in den Ordner HoldEmShowdown kopiert und konnte Showdown.java kompilieren, aber kann die Datei nicht ausführen.
Wie kann man Showdown.java ausführen?
Über BAT- und JAR-Datei hat es doch auch funktioniert.
Ich bin Anfänger in Java und habe mir hier die JAR-Datei und Quellcode heruntergeladen von Stevebecher:
brecware Software
Wenn ich auf die BAT-Datei klicke, funktioniert alles - das DOS-Fenster öffnet sich, und man kann seine Eingaben machen.

In der BAT-Datei steht nur @java -jar HoldemShowdown.jar
In den Metadaten - „META-INF/MANIFEST.MF“ - in der JAR-Datei steht:
Manifest-Version: 1.0
Sealed: true
Main-Class: com.stevebrecher.showdown.Showdown
Daher ging ich davon aus, dass Showdown.java die auszuführende Datei ist. Dort habe ich dann auch die main-Methode gefunden.
Java:
package com.stevebrecher.showdown;
import java.io.*;
import static java.lang.System.*;
import java.util.*;
public final class Showdown {
static final String VERSION = "2010Jun20.0";
// The following defaults can be overridden by program arguments
// -------------------------------------------------------------
// Argument format: output path_to_file
static File outFile = new File("Showdown.txt"); // in addition to console
// Argument format: threads number_of_threads
static int threads = Runtime.getRuntime().availableProcessors();
// Argument format: timed
static boolean timed = false; // output computation time?
// Argument format: repeat
// --useful in exercising the JVM/JIT compiler on the enumeration code path
// for a specific user input before observing the computation time. Normally
// the timed argument would also be provided.
static boolean repeat = false; // repeat calc on first user input until externally terminated?
private static PrintStream outStream;
public static void main(String[] args) {
if (getArgs(args)) {
openOutFile();
showIntro();
Enumerator[] enumerators = new Enumerator[threads];
UserInput ui = UserInput.newUserInput();
while (ui != null) {
long nanosecs = System.nanoTime();
for (int i = 0; i < enumerators.length; i++) {
enumerators[i] = new Enumerator(i, threads,
ui.deck(), ui.holeCards(), ui.nUnknown(), ui.boardCards());
enumerators[i].start();
}
for (Enumerator enumerator : enumerators) {
try {
enumerator.join();
} catch (InterruptedException never) {}
}
nanosecs = System.nanoTime() - nanosecs;
Output.resultsOut(ui, enumerators, outStream);
if (timed)
for (PrintStream stream : new PrintStream[] {System.out, outStream}) {
stream.printf("seconds = %.2f%n", nanosecs / 1e9);
stream.flush();
}
if (!repeat)
ui = UserInput.newUserInput();
}
}
}
private static boolean getArgs(String[] args) {
int threads = 0;
File outFile = null;
Iterator<String> iter = new ArrayList<String>(Arrays.asList(args)).iterator();
String error = "";
while (iter.hasNext()) {
String arg = iter.next().toLowerCase();
if (arg.equals("threads") ) {
if (iter.hasNext()) {
try {
threads = Integer.parseInt(iter.next());
} catch (NumberFormatException e) { }
}
if (threads > 0)
Showdown.threads = threads;
else {
error = "Threads value must be a number greater than zero.";
break;
}
} else if (arg.equals("output") ) {
if (iter.hasNext()) {
outFile = new File(iter.next());
try {
outFile.createNewFile();
} catch (Exception e) {
outFile = null;
}
}
if (outFile != null)
Showdown.outFile = outFile;
else {
error = "Output value missing or unable to access or create file.";
break;
}
} else if (arg.equals("timed")) {
Showdown.timed = true;
} else if (arg.equals("repeat")) {
Showdown.repeat = true;
} else
error = "Unrecognized program argument: " + arg;
}
if (error.length() > 0) {
out.println(error);
return false;
}
return true;
}
private static void openOutFile() {
try {
final boolean APPEND = true;
outStream = new PrintStream(new BufferedOutputStream(
new FileOutputStream(outFile, APPEND)));
if (outFile.length() == 0)
outStream.println("View this file with a fixed-width font such as Courier");
} catch (Exception e) {
System.err.println(e);
}
}
private static void showIntro() {
out.println(" HoldEm Showdown version " + VERSION + " written by Steve Brecher");
out.println("Deals all possible boards to get exact win probability for each hand specified.");
out.println("Results written/appended to \"" + outFile + "\".");
out.println();
out.println("For general help, type \"help\" or just \"h\" followed by Return or Enter.");
out.println("For help with a specific response, type \"?\" followed by Return or Enter.");
}
}
Aber egal wo ich Showdown.java kompiliere, ich kann die Datei nicht ausführen.
Wenn die JAR-Datei: HoldEmShowdown.jar entpackt ist, sieht das wie folgt aus:
HoldEmShowdown\com\stevebrecher\poker
enthält
Card.java, CardSet.java, HandEval.java
und
HoldEmShowdown\com\stevebrecher\showdown
enthält
Enumerator.java, Help.java, Output.java, Showdown.java, UserInput
Wenn ich Showdown.java in dem Ordner showdown kompileren möchte, bekomme ich die Fehler ausgegeben:
SyntaxErrorObject{line=34, col=3, classname='Showdown', message='cannot find symbol', errorline=' Enumerator[] enumerators = new Enumerator[threads];', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='Enumerator', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=34, col=34, classname='Showdown', message='cannot find symbol', errorline=' Enumerator[] enumerators = new Enumerator[threads];', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='Enumerator', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=35, col=3, classname='Showdown', message='cannot find symbol', errorline=' UserInput ui = UserInput.newUserInput();', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='UserInput', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=35, col=18, classname='Showdown', message='cannot find symbol', errorline=' UserInput ui = UserInput.newUserInput();', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='variable', locationName='class', symbol='UserInput', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=42, col=26, classname='Showdown', message='cannot find symbol', errorline=' enumerators = new Enumerator(i, threads,', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='Enumerator', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=46, col=9, classname='Showdown', message='cannot find symbol', errorline=' for (Enumerator enumerator : enumerators) {', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='Enumerator', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=53, col=4, classname='Showdown', message='cannot find symbol', errorline=' Output.resultsOut(ui, enumerators, outStream);', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='variable', locationName='class', symbol='Output', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=61, col=10, classname='Showdown', message='cannot find symbol', errorline=' ui = UserInput.newUserInput();', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='variable', locationName='class', symbol='UserInput', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=34, col=34, classname='Showdown', message='cannot find symbol', errorline=' Enumerator[] enumerators = new Enumerator[threads];', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='Enumerator', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=35, col=3, classname='Showdown', message='cannot find symbol', errorline=' UserInput ui = UserInput.newUserInput();', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='UserInput', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=35, col=18, classname='Showdown', message='cannot find symbol', errorline=' UserInput ui = UserInput.newUserInput();', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='variable', locationName='class', symbol='UserInput', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=42, col=26, classname='Showdown', message='cannot find symbol', errorline=' enumerators = new Enumerator(i, threads,', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='Enumerator', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=46, col=9, classname='Showdown', message='cannot find symbol', errorline=' for (Enumerator enumerator : enumerators) {', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='class', locationName='class', symbol='Enumerator', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=53, col=4, classname='Showdown', message='cannot find symbol', errorline=' Output.resultsOut(ui, enumerators, outStream);', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='variable', locationName='class', symbol='Output', location='com.stevebrecher.showdown.Showdown'}}
SyntaxErrorObject{line=61, col=10, classname='Showdown', message='cannot find symbol', errorline=' ui = UserInput.newUserInput();', syntaxErrorObjectDetails=SyntaxErrorObjectDetails{symbolName='variable', locationName='class', symbol='UserInput', location='com.stevebrecher.showdown.Showdown'}}
Daraufhin habe ich Showdown.java in den Ordner HoldEmShowdown kopiert und konnte Showdown.java kompilieren, aber kann die Datei nicht ausführen.
Wie kann man Showdown.java ausführen?
Über BAT- und JAR-Datei hat es doch auch funktioniert.