API laden problem mit package

Status
Nicht offen für weitere Antworten.

spong3bob

Aktives Mitglied
Hallo!
ich habe mir eine API runtergeladen (zum öffnen von mpqs) jlibmpq heißt sie...
Das zip-archiv enthält: eine dll, eine .exp eine .lib und 4 .java files..

ich hab die .dll mal in den system32 ordner gepackt und versucht die .java zu kompilieren ( da gibts auch probleme, weil das irgendwie mit den packages nicht funktioniert.. ich verwende Textpad, wenn ich jetzt kompilieren will sagt er, er findet die Klasse MPQ nicht (MPQ habe ich zuerst kompiliert, da hat das funktioniert)
was muss ich machen, dass ich das kompilieren kann (dass er das package erkennt)

Falls sich jemand meines problems erbarmen will, und aus meiner beschreibung nicht schlau wird häng ich mal die files an...
Download
 
Du solltest schon schon den Code, mit dem du per JNI die dll einbindest und auch die genaue Fehlermeldung hier posten. Mit dem vorhandenen wird dir kaum einer helfen können (die dll gehört davon ab auch nicht in eine Betriebssystem ordner sondern in das Installationsverzeichnis deines Programmes).
 
ich hab schon ein problem mim package... wenn ich die 1. datei kompiliere, und dann in einer 2. das package importieren will funktioniert das iwie ned..
außerdem kann ich die 2. datei nicht kompilieren, welche ein objekt der ersten datei enthält ( findet die klasse MPQ einfach nicht...)

Code:
package com.zthread.libmpq;

import java.net.*;
import java.io.*;

public class MPQ {

	private static final String LIST_FILE = "(listfile)";

	private static final int LIBMPQ_MPQ_ARCHIVE_SIZE				= 1;		/* MPQ archive size */
	private static final int LIBMPQ_MPQ_HASHTABLE_SIZE			= 2;		/* MPQ archive hashtable size */
	private static final int LIBMPQ_MPQ_BLOCKTABLE_SIZE		= 3;		/* MPQ archive blocktable size */
	private static final int LIBMPQ_MPQ_BLOCKSIZE					= 4;		/* MPQ archive blocksize */
	private static final int LIBMPQ_MPQ_NUMFILES						= 5;		/* Number of files in the MPQ archive */
	private static final int LIBMPQ_MPQ_COMPRESSED_SIZE		= 6;		/* Compressed archive size */
	private static final int LIBMPQ_MPQ_UNCOMPRESSED_SIZE 	= 7;		/* Uncompressed archive size */



	static {
		System.loadLibrary("libmpq");
	}

	public static native String getLibraryVersion();
	private native int openArchive(						String file);
	private native int getArchiveInfo(				int archiveHandle, int info);
	protected native int getFileInfoByNumber(		int archiveHandle, int file, int info);
	protected native byte[] getFileData(				int archiveHandle, int file);
	private native int getFileNumberByName(		int archiveHandle, String file);
	private native int closeArchive(					int archiveHandle);


	protected int archiveHandle = -1;


	public MPQ(String archive) throws Exception {
		int code = openArchive(archive);

		if(code < 0)
			throw new Exception("Opening MPQ Error Code: " + code);
		else
			archiveHandle = code;
	}

	public int getArchiveSize(){
		return getArchiveInfo(archiveHandle, LIBMPQ_MPQ_ARCHIVE_SIZE);
	}

	public int getHashTableSize(){
		return getArchiveInfo(archiveHandle, LIBMPQ_MPQ_HASHTABLE_SIZE);
	}

	public int getBlockTableSize(){
		return getArchiveInfo(archiveHandle, LIBMPQ_MPQ_BLOCKTABLE_SIZE);
	}

	public int getBlockSize(){
		return getArchiveInfo(archiveHandle, LIBMPQ_MPQ_BLOCKSIZE);
	}

	public int getNumberOfFiles(){
		return getArchiveInfo(archiveHandle, LIBMPQ_MPQ_NUMFILES);
	}

	public int getCompressedSize(){
		return getArchiveInfo(archiveHandle, LIBMPQ_MPQ_COMPRESSED_SIZE);
	}

	public int getUncompressedSize(){
		return getArchiveInfo(archiveHandle, LIBMPQ_MPQ_UNCOMPRESSED_SIZE);
	}

	public int closeArchive(){
		return closeArchive(archiveHandle);
	}

	public String[] getFileList() throws Exception {
		int file = getFileNumberByName(archiveHandle,"(listfile)");

		if(file < 1)
			throw new Exception("No file list (or other error): " + file);

		String fileCrap = new String(getFileData(archiveHandle,file));

		return fileCrap.split("\r\n");
	}
/*
	public MPQFile getFile(String fileName){
		int file = getFileNumberByName(archiveHandle,fileName);

		return new MPQFile(this,file,fileName);
	}

	public MPQFile getFile(int file){

		return new MPQFile(this,file,"");

	}
*/

}

das is die klasse, wo die dll eingebunden wird..

Code:
package com.zthread.libmpq;

public class MPQFile {

	private static final int LIBMPQ_FILE_COMPRESSED_SIZE		= 1;		/* MPQ compressed filesize of given file */
	private static final int LIBMPQ_FILE_UNCOMPRESSED_SIZE	= 2;		/* MPQ uncompressed filesize of given file */
	private static final int LIBMPQ_FILE_COMPRESSION_TYPE	= 3;		/* MPQ compression type of given file */
	private static final int LIBMPQ_FILE_TYPE_INT					= 4;		/* file is given by number */
	private static final int LIBMPQ_FILE_TYPE_CHAR					= 5;		/* file is given by name */
	private static final int LIBMPQ_FILE_HASH1							= 6;		/* hash value 1 */
	private static final int LIBMPQ_FILE_HASH2							= 7;		/* hash value 2 */

	//private final int archiveHandle;
	private final MPQ mpq;
	private final int file;
	private final String name;


	public MPQFile(MPQ mpq, int file, String name){
		this.mpq = mpq;
		this.file = file;
		this.name = name == null ? "" : name;

	}

	public int getFileNumber(){ return file; }
	public String getFileName(){ return name; }

	public int getCompressedSize(){
		return mpq.getFileInfoByNumber(mpq.archiveHandle, file, LIBMPQ_FILE_COMPRESSED_SIZE);
	}
	public int getUncompressedSize(){
		return mpq.getFileInfoByNumber(mpq.archiveHandle, file, LIBMPQ_FILE_UNCOMPRESSED_SIZE);
	}
	public int getCompressionType(){
		return mpq.getFileInfoByNumber(mpq.archiveHandle, file, LIBMPQ_FILE_COMPRESSION_TYPE);
	}
	public int getFileType(){
		return mpq.getFileInfoByNumber(mpq.archiveHandle, file, LIBMPQ_FILE_TYPE_INT);
	}
	public char getFileTypeChar(){
		return (char)mpq.getFileInfoByNumber(mpq.archiveHandle, file, LIBMPQ_FILE_TYPE_CHAR);
	}
	public int getHash1(){
		return mpq.getFileInfoByNumber(mpq.archiveHandle, file, LIBMPQ_FILE_HASH1);
	}
	public int getHash2(){
		return mpq.getFileInfoByNumber(mpq.archiveHandle, file, LIBMPQ_FILE_HASH2);
	}

	public byte[] getData(){
		return mpq.getFileData(mpq.archiveHandle,file);
	}
}
und diese kann ich nicht kompilieren...

achja, das is die fehlermeldung..

C:\Dokumente und Einstellungen\spong3bob\Eigene Dateien\Wc3Java\MPQFile.java:14: cannot find symbol
symbol : class MPQ
location: class com.zthread.libmpq.MPQFile
private final MPQ mpq;
 
Status
Nicht offen für weitere Antworten.

Zurück
Oben