PDA

View Full Version : Error From Starting Client



neon ghost
June 27th, 2010, 19:08
Exception in thread "main" java.lang.NoClassDefFoundError: Jframe
Caused by: java.lang.ClassNotFoundException: Jframe
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Jframe. Program will exit.
Press any key to continue . . .

My friend gets this when he tries to run the client. Here's what my run code is


@echo off
title Client
java -Xmx300m Jframe 10 0 highmem members 32
pause

Fire cape
June 27th, 2010, 19:09
Exception in thread "main" java.lang.NoClassDefFoundError: Jframe
Caused by: java.lang.ClassNotFoundException: Jframe
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Jframe. Program will exit.
Press any key to continue . . .

My friend gets this when he tries to run the client. Here's what my run code is


@echo off
title Client
java -Xmx300m Jframe 10 0 highmem members 32
pause

Try
@echo off
title Client
cd bin
java -Xmx300m Jframe 10 0 highmem members 32
pause

neon ghost
June 27th, 2010, 19:13
He says he got this.


The system cannot find the path specified.
Exception in thread "main" java.lang.NoClassDefFoundError: Jframe
Caused by: java.lang.ClassNotFoundException: Jframe
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Jframe. Program will exit.
Press any key to continue . . .

Fire cape
June 27th, 2010, 19:16
He says he got this.


The system cannot find the path specified.
Exception in thread "main" java.lang.NoClassDefFoundError: Jframe
Caused by: java.lang.ClassNotFoundException: Jframe
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Jframe. Program will exit.
Press any key to continue . . .

It cant find the "main" method in the class Jframe.

neon ghost
June 27th, 2010, 19:18
It cant find the "main" method in the class Jframe.

How would I fix this?

Fire cape
June 27th, 2010, 19:19
How would I fix this?

Find your "Main" method.
Then replace JFrame with whatever class it was in.

neon ghost
June 27th, 2010, 19:21
import sign.signlink;
import java.net.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.*;
import javax.swing.plaf.metal.MetalLookAndFeel;


public class Jframe extends client implements ActionListener {

private static JMenuItem menuItem;
private JFrame frame;

public Jframe(String args[]) {
super();
try {
sign.signlink.startpriv(InetAddress.getByName(serv er));
initUI();
} catch (Exception ex) {
ex.printStackTrace();
}
}

public void initUI() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAn dFeelClassName());
JPopupMenu.setDefaultLightWeightPopupEnabled(false );
frame = new JFrame("Project Insanity");
frame.setLayout(new BorderLayout());
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
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[] { "Project-Insanity.net", "-", "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("Only the registered members can see the link." + 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 "";
}

private 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("Project-Insanity.net")) {
openUpWebSite("Only the registered members can see the link.");
}
}
} catch (Exception e) {
}
}
}

I'm not sure what you mean, but heres my JFrame.java if it helps.

neon ghost
June 27th, 2010, 19:38
Anyone see what's wrong?