Page 1 of 2 12 LastLast
Results 1 to 20 of 38
  1. #1
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default JDK 1.6 and Eclipse 6.0.1

    Hi All

    I have a problem to use JDK 1.6 and Eclipse 6.0.1. I got error like this

    "Could not fiend main class.Progrram will exit"

    How can i solve this..

  2. #2
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Hello Mir,
    I think ur environment variable's path for jdk is not set correctly, Check that.
    To finish sooner, take your own time....
    Nivedithaaaa

  3. #3
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Hello Mir,
    I think ur environment variable's path for jdk is not set correctly, Check that.
    Thxs for reply

    Can tou tell how can i set correct set enviroment.Becouse i am setting through my computer ->Advance setting....

  4. #4
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Yes there itself..
    JAVA_HOME should be set to something like C:\Program Files\Java\jdk1.6.0_01

    To check go to command prompt and type "java" u should get some response and even for javac. This would mean that ur java doesnt have any problem then we can chk out with eclipse for error.
    To finish sooner, take your own time....
    Nivedithaaaa

  5. #5
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Yes there itself..
    JAVA_HOME should be set to something like C:\Program Files\Java\jdk1.6.0_01

    To check go to command prompt and type "java" u should get some response and even for javac. This would mean that ur java doesnt have any problem then we can chk out with eclipse for error.
    I did like same way and i check command promt.It is responding..

    But eclipse error is same..

    Java Code:
    java.lang.UnsupportedClassVersionError: Bad version number in .class file
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(Unknown Source)
    	at java.security.SecureClassLoader.defineClass(Unknown Source)
    	at java.net.URLClassLoader.defineClass(Unknown Source)
    	at java.net.URLClassLoader.access$100(Unknown Source)
    	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)
    	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Exception in thread "main"

  6. #6
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Oh ok got it...
    I think the code u are trying to run is created in a different version of jdk which is not supported by jdk 6
    To finish sooner, take your own time....
    Nivedithaaaa

  7. #7
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    To finish sooner, take your own time....
    Nivedithaaaa

  8. #8
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Oh ok got it...
    I think the code u are trying to run is created in a different version of jdk which is not supported by jdk 6
    No Niveditha..

    I try to run which is develop on jdk 6. Can you give me small code of jdk 6.

  9. #9
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Hi,
    Even i have jdk1.6 installed and the following code is running perfectly in my comp.

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    
    public class ProgressSample2 {
      public static void main(String args[]) {
        final JProgressBar aJProgressBar = new JProgressBar(0, 100);
        aJProgressBar.setIndeterminate(true);
    
        JButton aJButton = new JButton("Toggle");
    
        ActionListener actionListener = new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            boolean indeterminate = aJProgressBar.isIndeterminate();
            aJProgressBar.setIndeterminate(!indeterminate);
          }
        };
    
        aJButton.addActionListener(actionListener);
    
        JFrame theFrame = new JFrame("Indeterminate");
        theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container contentPane = theFrame.getContentPane();
        contentPane.add(aJProgressBar, BorderLayout.NORTH);
        contentPane.add(aJButton, BorderLayout.SOUTH);
        theFrame.setSize(300, 100);
        theFrame.show();
      }
    }
    To finish sooner, take your own time....
    Nivedithaaaa

  10. #10
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Hi,
    Even i have jdk1.6 installed and the following code is running perfectly in my comp.

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    
    public class ProgressSample2 {
      public static void main(String args[]) {
        final JProgressBar aJProgressBar = new JProgressBar(0, 100);
        aJProgressBar.setIndeterminate(true);
    
        JButton aJButton = new JButton("Toggle");
    
        ActionListener actionListener = new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            boolean indeterminate = aJProgressBar.isIndeterminate();
            aJProgressBar.setIndeterminate(!indeterminate);
          }
        };
    
        aJButton.addActionListener(actionListener);
    
        JFrame theFrame = new JFrame("Indeterminate");
        theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container contentPane = theFrame.getContentPane();
        contentPane.add(aJProgressBar, BorderLayout.NORTH);
        contentPane.add(aJButton, BorderLayout.SOUTH);
        theFrame.setSize(300, 100);
        theFrame.show();
      }
    }
    Sorry to say but i have same problem after run your code..

  11. #11
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    If u dont mind can u give me ur code i ll try to run it on my PC?
    To finish sooner, take your own time....
    Nivedithaaaa

  12. #12
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    else it may be problem with a java version too that u have installed. Delete everything u have connected to java and install it freshly just like in a new machine.
    To finish sooner, take your own time....
    Nivedithaaaa

  13. #13
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default

    Bad version number in .class file
    That could mean that the class file is from an younger version of Java, say 1.6 and the java program you are using is older and doesn't recognize the version number in the class file and gives that error message.
    What version of java are you using to execute the class files?
    Enter java -version to see what version. Here's what I see:
    C:\Documents and Settings\Owner>java -version
    java version "1.5.0_04"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
    Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)

  14. #14
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    else it may be problem with a java version too that u have installed. Delete everything u have connected to java and install it freshly just like in a new machine.
    what you mean to delete jkd and jre or something more..

  15. #15
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    else it may be problem with a java version too that u have installed. Delete everything u have connected to java and install it freshly just like in a new machine.
    See why i am trying do that becouse i want to add background picture on dailog box. Can you give me some code of set background picture(.gif) and set some label.. which is run on 1.5.

    Plz help me

  16. #16
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    what you mean to delete jkd and jre or something more..
    Yes i meant the same....

    Can you give me some code of set background picture(.gif) and set some label.. which is run on 1.5.
    i think this is the reason why u r getting error with jdk 1.6. Because the code was written in jdk1.5 and u r trying to run in jdk1.6,there may be some deprecated methods in the code that is not supported by jdk1.6 but were supported in jdk1.5

    And code give me some time.
    To finish sooner, take your own time....
    Nivedithaaaa

  17. #17
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    Yes i meant the same....



    i think this is the reason why u r getting error with jdk 1.6. Because the code was written in jdk1.5 and u r trying to run in jdk1.6,there may be some deprecated methods in the code that is not supported by jdk1.6 but were supported in jdk1.5

    And code give me some time.
    Here is code which is written in 1.6

    Java Code:
    import java.awt.event.*;
    import javax.swing.*;
    
    public class Image extends JFrame {
    
        private JPanel jPanel1;    
        private JButton jButton1;
        private JLabel jLabel1;
        
        public Image() {
            jPanel1 = new JPanel();
            jButton1 = new JButton("OK");
            jLabel1 = new JLabel("your label goes here");
    
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            addWindowListener(new WindowAdapter() {
                public void windowOpened(WindowEvent evt) {
                    formWindowOpened(evt);
                }
            });
    
            GroupLayout jPanel1Layout = new GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(139, 139, 139)
                            .addComponent(jButton1))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(126, 126, 126)
                            .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(151, Short.MAX_VALUE))
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                    .addGap(63, 63, 63)
                    .addComponent(jLabel1)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 70, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(130, 130, 130))
            );
    
            GroupLayout layout = new GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
    
            pack();        
        }
      
        private void formWindowOpened(WindowEvent evt) {                                  
            ImageIcon imageBack = new ImageIcon("images/master03_background.gif");
            JLabel background = new JLabel(imageBack);
            background.setBounds(0, 0, imageBack.getIconWidth(), imageBack.getIconHeight());
    	getLayeredPane().add(background, new Integer(Integer.MIN_VALUE));
            jPanel1.setOpaque(false);
            setContentPane(jPanel1);       
        }
        
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Demo().setVisible(true);
                }
            });
        }
        
    }
    Plz help me..

  18. #18
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    You can add the background image to a Jpanel and then add that panel into JDialog.

    You will get lots of examples for adding background image to a Jpanel in google.Try once.
    To finish sooner, take your own time....
    Nivedithaaaa

  19. #19
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Niveditha View Post
    You can add the background image to a Jpanel and then add that panel into JDialog.

    You will get lots of examples for adding background image to a Jpanel in google.Try once.
    I found some example but i am not abel to do that with dialog.you want to see my code of that..

    help me

  20. #20
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Hi,
    Check this code its working fine...
    Java Code:
    import java.awt.* ;
    import java.awt.Image;
     
    import javax.swing.* ;
     
    public class JFrameBg extends JFrame {
    	
    	public JFrameBg() {
    		super() ;
    		setTitle( "Background Image on JFrame or JDialog or JApplet" ) ;
    		setDefaultCloseOperation( EXIT_ON_CLOSE ) ;
    		setContentPane( new MyPanel() ) ;
    		getContentPane().add( new JLabel( "It is a Label" , new ImageIcon( "D:/Personal/Shilu/teddy,bmp" ) , JLabel.CENTER ) ) ;
    		setSize( 400 , 300 ) ;
    		setVisible( true ) ;
    	}
    	
    	public class MyPanel extends JPanel {
    		private Image img ;
    		public MyPanel() {
    			setLayout( new BorderLayout() ) ;
    			img = new ImageIcon( "D:/Personal/Shilu/rose.jpg" ).getImage() ;
    			if( img == null ) {
    				System.out.println( "Image is null" );
    				System.exit( 1 ) ;
    			}
    			if( img.getHeight(this) <= 0 || img.getWidth( this ) <= 0 ) {
    				System.out.println( "Image width or height must be +ve" );
    				System.exit( 2 ) ;
    			}
    		}
    		public void drawBackground( Graphics g ) {
    			int w = getWidth() ;
    			int h = getHeight() ;
    			int iw = img.getWidth( this ) ;
    			int ih = img.getHeight( this ) ;
    			for( int i = 0 ; i < w ; i+=iw ) {
    				for( int j = 0 ; j < h ; j+= ih ) {
    					g.drawImage( img , i , j , this ) ;
    				}
    			}
    		}
    		protected void paintComponent(Graphics g) {
    			super.paintComponent(g);
    			drawBackground( g ) ;
    		}
    	}
    	
    	public static void main(String[] args) {
    		new JFrameBg() ;
    	}
    }
    To finish sooner, take your own time....
    Nivedithaaaa

Page 1 of 2 12 LastLast

Similar Threads

  1. use eclipse key
    By idan72 in forum Eclipse
    Replies: 0
    Last Post: 05-04-2008, 04:21 PM
  2. Eclipse GUI
    By XiaoXiao in forum Eclipse
    Replies: 0
    Last Post: 01-23-2008, 10:55 AM
  3. SDE for Eclipse 4.1 sp1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-04-2007, 09:13 PM
  4. SDE for Eclipse 4.1
    By levent in forum Java Software
    Replies: 0
    Last Post: 08-04-2007, 07:47 PM
  5. SDE for Eclipse 4.0 SP2
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-15-2007, 05:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •