[Galkons Refactored] Error: Could not find or load main class Jframe
I've had this problem b4, can't remember how I fixed it :\ Really annoying because I want to start programming servers again.
EDIT: Fixed *-cp bin credz to kamiel
if anyone wants the compiler
Code:
@echo off
title Initiate Client
echo Initializing Client.
echo Please Wait Patiently...
java -cp bin client/Jframe -Xmx300m 10 0 highmem members 32
pause
Error
Code:
Running Client.
Please Wait Patiently...
Error: Could not find or load main class Jframe
Press any key to continue . . .
Run Client.bat
Code:
@echo off
title Run Client
echo Running Client.
echo Please Wait Patiently...
java -Xmx300m Jframe 10 0 highmem members 32
pause
Source Packaging (in default package)
[Only registered and activated users can see links. Click Here To Register...]
Jframe class
[SPOIL]
Code:
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.*;
public class Jframe extends Client implements ActionListener {
public static JMenuItem menuItem;
public JFrame frame;
public Jframe(String args[]) {
super();
try {
sign.signlink.startpriv(InetAddress.getByName(server));
initUI();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void initUI() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
frame = new JFrame("Galkon's Refactored");
frame.setLayout(new BorderLayout());
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel gamePanel = new JPanel();
gamePanel.setLayout(new BorderLayout());
gamePanel.add(this);
gamePanel.setPreferredSize(new Dimension(765, 503));
JMenu fileMenu = new JMenu("File");
String[] mainButtons = new String[] { "Rune-Server", "-", "Exit" };
for (String name : mainButtons) {
JMenuItem menuItem = new JMenuItem(name);
if (name.equalsIgnoreCase("-")) {
fileMenu.addSeparator();
} else {
menuItem.addActionListener(this);
fileMenu.add(menuItem);
}
}
JMenuBar menuBar = new JMenuBar();
JMenuBar jmenubar = new JMenuBar();
frame.add(jmenubar);
menuBar.add(fileMenu);
frame.getContentPane().add(menuBar, BorderLayout.NORTH);
frame.getContentPane().add(gamePanel, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true); // can see the client
frame.setResizable(false); // resizeable frame
init();
} catch (Exception e) {
e.printStackTrace();
}
}
public URL getCodeBase() {
try {
return new URL("http://" + server + "/cache");
} catch (Exception e) {
return super.getCodeBase();
}
}
public URL getDocumentBase() {
return getCodeBase();
}
public void loadError(String s) {
System.out.println("loadError: " + s);
}
public String getParameter(String key) {
return "";
}
public static void openUpWebSite(String url) {
Desktop d = Desktop.getDesktop();
try {
d.browse(new URI(url));
} catch (Exception e) {
}
}
public void actionPerformed(ActionEvent evt) {
String cmd = evt.getActionCommand();
try {
if (cmd != null) {
if (cmd.equalsIgnoreCase("exit")) {
System.exit(0);
}
if (cmd.equalsIgnoreCase("Rune-Server")) {
openUpWebSite("http://www.rune-server.ee/");
}
}
} catch (Exception e) {
}
}
}
[/SPOIL]
I think this may had been cause by me configuring a source folder (done through eclipse) so the location in the Run Client.bat shouldn't need changing.
I'll rep anyone who gives proper help :) tyzz