Thread: [PI - rep] Error: Could not find or load main class server.Server

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 [PI - rep] Error: Could not find or load main class server.Server 
    Banned

    Join Date
    Jul 2011
    Age
    30
    Posts
    745
    Thanks given
    2,207
    Thanks received
    451
    Rep Power
    0
    I'm getting this
    Code:
    Error: Could not find or load main class server.Server
    When trying to start my server, the only thing I can think of is the packaging since I changed it

    My run.bat
    Code:
    java -Xmx800m -cp bin;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jar; server.Server
    I'm not sure if the line marked in red is the location of my server class or not, but if it is it shouldn't be because it's still located in that location :\

    if anyone could tell me whats wrong or give me pointers to fix it I'll give them a rep
    Reply With Quote  
     

  2. #2  
    arrowzftw
    Guest
    Post your server.java or post the package detail.
    Reply With Quote  
     

  3. #3  
    محمد

    Jamili's Avatar
    Join Date
    Jun 2010
    Posts
    405
    Thanks given
    93
    Thanks received
    249
    Rep Power
    307
    Maybe it can't find it because you did something with the main method?
    Go to Server.Java, search for "void main", make sure it has the parameters "(String[] args)". If they didn't work, then try using an IDE to fix the problem

    Spoiler for Honorable mentions:

    Quote Originally Posted by JRFisher View Post
    Dude, learn yourself, it took me 17 months of continuous research to learn how to import a project.
    Quote Originally Posted by Pollution View Post
    When? And Idiot, I'm using a oldschool, it's not easy to get the command for an oldschool, retard c u.
    Quote Originally Posted by Waj_Assif View Post
    I sayin u dont contribute never aall u do is finna tryin attack ppl and always finna start fights .......
    Quote Originally Posted by Kris View Post
    You must be one of those slower breeds.
    Quote Originally Posted by Gandalf View Post
    Just piss off ploter hacker fella dumb fuck. Your a donor to a rsps community, I'm a Mainowner to a Private Server thats 7+ Years old. Lmfao kid, get a life. Don't let my name come out of your mouth again. Or it wont end nicely for you. Understand me big boy?
    Quote Originally Posted by Tojad View Post
    What do you know about Public Void and int without this [] is only 1 integer, why?
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jul 2011
    Age
    30
    Posts
    745
    Thanks given
    2,207
    Thanks received
    451
    Rep Power
    0


    Code:
    package server;
    
    import java.io.IOException;
    import java.net.InetSocketAddress;
    import java.text.DecimalFormat;
    
    import org.apache.mina.common.IoAcceptor;
    import org.apache.mina.transport.socket.nio.SocketAcceptor;
    import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
    
    import server.engine.event.EventManager;
    import server.engine.network.ConnectionHandler;
    import server.engine.network.ConnectionThrottleFilter;
    import server.engine.util.Logger;
    import server.engine.util.SimpleTimer;
    import server.engine.world.ItemHandler;
    import server.engine.world.ObjectHandler;
    import server.engine.world.ObjectManager;
    import server.engine.world.ShopHandler;
    import server.game.minigame.CastleWars;
    import server.game.minigame.FightCaves;
    import server.game.minigame.FightPits;
    import server.game.minigame.PestControl;
    import server.game.npc.NPCDrops;
    import server.game.npc.NPCHandler;
    import server.game.player.ClanChatHandler;
    import server.game.player.Client;
    import server.game.player.Player;
    import server.game.player.PlayerHandler;
    import server.game.player.PlayerSave;
    
    
    
    public class Server {
    
    
    	public static boolean sleeping;
    	public static final int cycleRate;
    	public static boolean UpdateServer = false;
    	public static long lastMassSave = System.currentTimeMillis();
    	private static IoAcceptor acceptor;
    	private static ConnectionHandler connectionHandler;
    	private static ConnectionThrottleFilter throttleFilter;
    	private static SimpleTimer engineTimer, debugTimer;
    	private static long cycleTime, cycles, totalCycleTime, sleepTime;
    	private static DecimalFormat debugPercentFormat;
    	public static boolean shutdownServer = false;
    	public static int garbageCollectDelay = 40;
    	public static boolean shutdownClientHandler;
    	public static int serverlistenerPort;
    	public static ItemHandler itemHandler = new ItemHandler();
    	public static PlayerHandler playerHandler = new PlayerHandler();
    	public static NPCHandler npcHandler = new NPCHandler();
    	public static ShopHandler shopHandler = new ShopHandler();
    	public static ObjectHandler objectHandler = new ObjectHandler();
    	public static ObjectManager objectManager = new ObjectManager();
    	public static CastleWars castleWars = new CastleWars();
    	public static FightPits fightPits = new FightPits();
    	public static PestControl pestControl = new PestControl();
    	public static NPCDrops npcDrops = new NPCDrops();
    	public static ClanChatHandler clanChat = new ClanChatHandler();
    	public static FightCaves fightCaves = new FightCaves();
    	//public static WorldMap worldMap = new WorldMap();
    	//private static final WorkerThread engine = new WorkerThread();
    
    	static {
    		if(!Config.SERVER_DEBUG) {
    			Server.serverlistenerPort = 43594;
    		} else {
    			Server.serverlistenerPort = 43594;
    		}
    		cycleRate = 600;
    		Server.shutdownServer = false;
    		Server.engineTimer = new SimpleTimer();
    		Server.debugTimer = new SimpleTimer();
    		Server.sleepTime = 0;
    		Server.debugPercentFormat = new DecimalFormat("0.0#%");
    	}
    	public static boolean playerExecuted = false;
    
    	private static void debug() {
    		if (Server.debugTimer.elapsed() > 360*1000 || Server.playerExecuted) {
    			final long averageCycleTime = Server.totalCycleTime / Server.cycles;
    			System.out.println("Average Cycle Time: " + averageCycleTime + "ms");
    			final double engineLoad = (double) averageCycleTime / (double) Server.cycleRate;
    			System.out.println("Players online: " + PlayerHandler.playerCount+ ", engine load: "+ Server.debugPercentFormat.format(engineLoad));
    			Server.totalCycleTime = 0;
    			Server.cycles = 0;
    			System.gc();
    			System.runFinalization();
    			Server.debugTimer.reset();
    			Server.playerExecuted = false;
    		}
    	}
    
    	public static long getSleepTimer() {
    		return Server.sleepTime;
    	}
    	//height,absX,absY,toAbsX,toAbsY,type
    	/*public static final boolean checkPos(int height,int absX,int absY,int toAbsX,int toAbsY,int type)
        {
            return I.I(height,absX,absY,toAbsX,toAbsY,type);
        }*/
    	public static void main(final java.lang.String args[]) throws NullPointerException, IOException {
    		/**
    		 * Starting Up Server
    		 */
    
    		System.setOut(new Logger(System.out));
    		System.setErr(new Logger(System.err));
    		System.out.println("Launching Project Insanity...");
    
    		/**
    		 * World Map Loader
    		 */
    		//if(!Config.SERVER_DEBUG)
    		//VirtualWorld.init();
    		//WorldMap.loadWorldMap();
    
    		/**
    		 * Script Loader
    		 */
    		//ScriptManager.loadScripts();
    
    		/**
    		 * Accepting Connections
    		 */
    		Server.acceptor = new SocketAcceptor();
    		Server.connectionHandler = new ConnectionHandler();
    		SocketAcceptorConfig sac = new SocketAcceptorConfig();
    		sac.getSessionConfig().setTcpNoDelay(false);
    		sac.setReuseAddress(true);
    		sac.setBacklog(100);
    		Server.throttleFilter = new ConnectionThrottleFilter(Config.CONNECTION_DELAY);
    		sac.getFilterChain().addFirst("throttleFilter", Server.throttleFilter);
    		Server.acceptor.bind(new InetSocketAddress(Server.serverlistenerPort), Server.connectionHandler, sac);
    
    		/**
    		 * Initialise Handlers
    		 */
    		EventManager.initialize();
    		Connection.initialize();
    		//PlayerSaving.initialize();
    		//MysqlManager.createConnection();
    
    		/**
    		 * Server Successfully Loaded
    		 */
    		System.out.println("Server listening on port 0.0.0.0:" + Server.serverlistenerPort);
    		/**
    		 * Main Server Tick
    		 */
    		try {
    			while (!Server.shutdownServer) {
    				if (Server.sleepTime >= 0) {
    					Thread.sleep(Server.sleepTime);
    				} else {
    					Thread.sleep(600);
    				}
    				Server.engineTimer.reset();
    				Server.itemHandler.process();
    				Server.playerHandler.process();
    				Server.npcHandler.process();
    				Server.shopHandler.process();
    				Server.objectManager.process();
    				Server.fightPits.process();
    				Server.pestControl.process();
    				Server.cycleTime = Server.engineTimer.elapsed();
    				Server.sleepTime = Server.cycleRate - Server.cycleTime;
    				Server.totalCycleTime += Server.cycleTime;
    				Server.cycles++;
    				Server.debug();
    				Server.garbageCollectDelay--;
    				if (Server.garbageCollectDelay == 0) {
    					Server.garbageCollectDelay = 40;
    					System.gc();
    				}
    				if (System.currentTimeMillis() - Server.lastMassSave > 300000) {
    					for(final Player p : PlayerHandler.players) {
    						if(p == null) {
    							continue;
    						}
    						PlayerSave.saveGame((Client)p);
    						System.out.println("Saved game for " + p.playerName + ".");
    						Server.lastMassSave = System.currentTimeMillis();
    					}
    
    				}
    			}
    		} catch (final Exception ex) {
    			ex.printStackTrace();
    			System.out.println("A fatal exception has been thrown!");
    			for(final Player p : PlayerHandler.players) {
    				if(p == null) {
    					continue;
    				}
    				PlayerSave.saveGame((Client)p);
    				System.out.println("Saved game for " + p.playerName + ".");
    			}
    		}
    		Server.acceptor = null;
    		Server.connectionHandler = null;
    		sac = null;
    		System.exit(0);
    	}
    
    	public static void processAllPackets() {
    		for (final Player player : PlayerHandler.players) {
    			if (player != null) {
    				while(player.processQueuedPackets()) {
    					;
    				}
    			}
    		}
    	}
    
    }
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Aug 2011
    Posts
    211
    Thanks given
    17
    Thanks received
    19
    Rep Power
    17
    Try this compiler:
    Code:
    @echo off
    "C:\Program Files\Java\jdk1.7.0\bin\javac.exe" -classpath deps/log4j-1.2.15.jar;deps/jython.jar;deps/xstream.jar;deps/mina.jar;deps/mysql.jar;deps/poi.jar;deps/slf4j.jar;deps/slf4j-nop.jar -d bin src\server\event\*.java src\server\model\items\*.java src\server\model\minigames\*.java src\server\model\npcs\*.java src\server\model\objects\*.java src\server\model\players\*.java src\server\model\players\skills\*.java src\server\model\players\packets\*.java src\server\model\shops\*.java src\server\net\*.java src\server\task\*.java src\server\util\*.java src\server\world\*.java src\server\util\log\*.java src\server\*.java src\server\world\map\*.java src/server/gui/*.java
    pause
    I'm assuming you're using JDK 7.

    And this Run-server:
    Code:
    @echo off
    title Hey ;) v2.0
    java -Xmx800m -cp bin;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jar; server.Server
    start Run-Server.bat
    exit
    I just c/ped mine lol.
    Reply With Quote  
     

  6. #6  
    Extreme Donator

    woof woof bish's Avatar
    Join Date
    May 2011
    Age
    26
    Posts
    2,444
    Thanks given
    2,212
    Thanks received
    1,019
    Rep Power
    5000
    Quote Originally Posted by Billionaire View Post
    Try this compiler:
    Code:
    @echo off
    "C:\Program Files\Java\jdk1.7.0\bin\javac.exe" -classpath deps/log4j-1.2.15.jar;deps/jython.jar;deps/xstream.jar;deps/mina.jar;deps/mysql.jar;deps/poi.jar;deps/slf4j.jar;deps/slf4j-nop.jar -d bin src\server\event\*.java src\server\model\items\*.java src\server\model\minigames\*.java src\server\model\npcs\*.java src\server\model\objects\*.java src\server\model\players\*.java src\server\model\players\skills\*.java src\server\model\players\packets\*.java src\server\model\shops\*.java src\server\net\*.java src\server\task\*.java src\server\util\*.java src\server\world\*.java src\server\util\log\*.java src\server\*.java src\server\world\map\*.java src/server/gui/*.java
    pause
    I'm assuming you're using JDK 7.

    And this Run-server:
    Code:
    @echo off
    title Hey ;) v2.0
    java -Xmx800m -cp bin;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jar; server.Server
    start Run-Server.bat
    exit
    I just c/ped mine lol.
    He posted exact the same run.bat
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Jul 2011
    Age
    30
    Posts
    745
    Thanks given
    2,207
    Thanks received
    451
    Rep Power
    0
    Quote Originally Posted by Snoop Dogg View Post
    Maybe it can't find it because you did something with the main method?
    Go to Server.Java, search for "void main", make sure it has the parameters "(String[] args)". If they didn't work, then try using an IDE to fix the problem
    I didn't fuck with it, but here's mine (final java.lang.String args[])


    Quote Originally Posted by Billionaire View Post
    Try this compiler:
    mine is the same as yours
    Reply With Quote  
     

  8. #8  
    arrowzftw
    Guest
    You sure your class files are in bin?
    if your using netbeans they might be in build/classes/
    Reply With Quote  
     

  9. #9  
    محمد

    Jamili's Avatar
    Join Date
    Jun 2010
    Posts
    405
    Thanks given
    93
    Thanks received
    249
    Rep Power
    307
    Change
    Code:
    public static void main(final java.lang.String args[]) throws NullPointerException, IOException {
    to this
    Code:
    public static void main(String args[]) throws NullPointerException, IOException {
    @
    Quote Originally Posted by arrowzftw View Post
    You sure your class files are in bin?
    if your using netbeans they might be in build/classes/
    He uses Eclipse, look at the picture.

    Spoiler for Honorable mentions:

    Quote Originally Posted by JRFisher View Post
    Dude, learn yourself, it took me 17 months of continuous research to learn how to import a project.
    Quote Originally Posted by Pollution View Post
    When? And Idiot, I'm using a oldschool, it's not easy to get the command for an oldschool, retard c u.
    Quote Originally Posted by Waj_Assif View Post
    I sayin u dont contribute never aall u do is finna tryin attack ppl and always finna start fights .......
    Quote Originally Posted by Kris View Post
    You must be one of those slower breeds.
    Quote Originally Posted by Gandalf View Post
    Just piss off ploter hacker fella dumb fuck. Your a donor to a rsps community, I'm a Mainowner to a Private Server thats 7+ Years old. Lmfao kid, get a life. Don't let my name come out of your mouth again. Or it wont end nicely for you. Understand me big boy?
    Quote Originally Posted by Tojad View Post
    What do you know about Public Void and int without this [] is only 1 integer, why?
    Reply With Quote  
     

  10. #10  
    arrowzftw
    Guest
    Quote Originally Posted by Snoop Dogg View Post
    Change
    Code:
    public static void main(final java.lang.String args[]) throws NullPointerException, IOException {
    to this
    Code:
    public static void main(String args[]) throws NullPointerException, IOException {
    @
    He uses Eclipse, look at the picture.
    He's using netbeans

    try this:
    Code:
    java -Xmx800m -cp build/classes;deps/poi.jar;deps/mysql.jar;deps/mina.jar;deps/slf4j.jar;deps/slf4j-nop.jar;deps/jython.jar;log4j-1.2.15.jar; server.Server
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 10
    Last Post: 08-11-2012, 08:25 PM
  2. couldnt find main class
    By motasem98 in forum Help
    Replies: 3
    Last Post: 12-09-2011, 06:26 PM
  3. Could not find main class: Client
    By Ch3ck it S0n in forum Help
    Replies: 2
    Last Post: 11-11-2011, 04:10 AM
  4. Could not find main class: Client
    By Mute in forum Help
    Replies: 2
    Last Post: 11-09-2011, 02:16 PM
  5. Could not find the main class: EGUI.
    By Armaros in forum Help
    Replies: 2
    Last Post: 07-13-2010, 06:32 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •