Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: I am stumped.

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry I am stumped.

    Ok so i created a simple window using swing. The problem I'm having is my .jar file runs fine on my computer, the program opens and does what I want, but when my friends try to open it on their computers it says ("could not find main .class, java will now close.")

    here is my netbeans project.

    First project.rar

    Maybe someone can help me figure this out. Thanks in advance.
    Last edited by Subvoltic; February 23rd, 2012 at 03:02 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: I am stumped.

    Please post your source code here in the forum. If it is too big, make a smaller version that compiles and executes and shows the problem.

    when my friends try to open it on their computers
    What are your friends opening? What versions of java do they have? What version of the JDK did you create the program with?

  3. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I am stumped.

    My friends are trying to open, the .jar file, I created with netbean's build button. I had them update their java to the newest version. I am using the newest version of the JDK.

    I have two .class files. Game.class is the main class file. and Window.class is the other one. When they try to run my program, it says "java couldn't find main class Game.class, java will now close." But the program works on my computer.

    Game.class

    import javax.swing.JFrame;
     
    public class Game extends JFrame {
     
        public Game() {
            add(new Window());
            setTitle("Game");
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setSize(600, 400);
            setLocationRelativeTo(null);
            setVisible(true);
            setResizable(true);
        }
        public static void main(String[] args) {
            Game game = new Game();
        }
    }

    Window.class

    import javax.swing.JPanel;
     
    public class Window extends JPanel {
        public Window() {        
        }
    }

    MAINIFEST

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.2
    Created-By: 1.7.0_03-b05 (Oracle Corporation)
    Class-Path: lib/swing-layout-1.0.4.jar
    X-COMMENT: Main-Class will be added automatically by build
    Main-Class: Game

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: I am stumped.

    What about the versions of java?
    Are you 1.7 and they are 1.6?

  5. #5
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I am stumped.

    Quote Originally Posted by Norm View Post
    What about the versions of java?
    Are you 1.7 and they are 1.6?
    I'm on the 1.7 JDk and I'm not sure what they are on whatever the newest version of JRE is, thats what they have.

  6. #6
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I am stumped.

    I just figured it out. Yeah i just updated my other computer to the JRE 7 and now it works. Thanks for the help though.

Similar Threads

  1. Logic issue(I believe) stumped
    By mwr76 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 23rd, 2011, 01:19 AM
  2. Array question. Stumped!
    By tjanuranus in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 5th, 2011, 02:35 PM
  3. help im stumped :(
    By gonfreecks in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 9th, 2010, 12:51 PM
  4. Help so stumped....
    By Macgrubber in forum Loops & Control Statements
    Replies: 8
    Last Post: October 28th, 2010, 03:53 PM
  5. Stumped?
    By KevinGreen in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 3rd, 2009, 01:02 AM