2 Replies - 2219 Views - Last Post: 09 December 2012 - 09:41 PM Rate Topic: -----

#1 PoopyMcSquirts  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-November 12

BlackJack Game Main Method Not being detected on run

Posted 08 December 2012 - 07:45 PM

This is my package declaration:
Note: this is not the complete code!

package blackJack111;

public class Game extends JFrame implements ActionListener {
    private DrawPanel drawPanel;
    
    private JButton btnDeal;
    
    private JButton btnHit;
    
    private JButton btnStand;
    
    private JButton btnNewGame;
    
    private Deck deck;
    
    private int currPlayer;
    
    public Game () {



This is my main method:

 public static void main( String args[] ) {
    	new Game().setVisible(true);




My problem with the current Java code I have is that Eclipse is detecting my package and main method as

"nameOfPackage".Game.Game."

This leads to Eclipse not recognizing the main method because it is being restructured at compile time. This is the error I receive when I try to compile and run:

Error: Could not find or load main class blackJack111.Game.



Can someone help me out here? What am I doing wrong? I have run this code without a package using only the default package, and the entire game did compile and run.

Now that I have a unique package name, the code does not want to compile and run. Any ideas what could be causing this?

How can I fix this problem?

Is This A Good Question/Topic? 0
  • +

Replies To: BlackJack Game Main Method Not being detected on run

#2 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2687
  • View blog
  • Posts: 11,348
  • Joined: 20-September 08

Re: BlackJack Game Main Method Not being detected on run

Posted 09 December 2012 - 01:57 AM

(assuming Windows) go Start|Run|cmd.exe
Please post the result of the following (you'll need to set the properties (right-click window title bar) to Quick Edit mode to copy/paste)

dir "%USERPROFILE%\workspace"

Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8328
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: BlackJack Game Main Method Not being detected on run

Posted 09 December 2012 - 09:41 PM

is your main() method in a .java code with
package blackJack111;

it should :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1