Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Cannot access JScrollPane, bad class file !!!!

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody. I have got a big big problem. I can not compile my code because this message alwayes is displayed:

C:\Java\hosseindab\Dabb.java:8: cannot access JScrollPane
bad class file: .\JScrollPane.class
class file contains wrong class: javax.swing.JScrollPane
Please remove or make sure it appears in the correct subdirectory of the classpath.
private JScrollPane skrollytan;

I tried to uninstall and reinstall SDK och Textpad, but it didn't work. I even installed them on another computer, but it was the same problem. I do not know what has happened. I have tried j2SDK 1_3_1_15 and j2sdk 1_4_0_01. No use. I could compile the same files some hours ago, but now the Textpad says NO, NO, NO!!! and generates the above error. Just please help me, I don't have much time to deliver my java program.
The code is:




import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Dabb extends JFrame implements ActionListener
{
private JLabel lBild1,lBild2,lBild3;
private JScrollPane skrollytan;
private JPanel panelen;
private JRadioButton knapp1, knapp2, knapp3;
private JSplitPane delning;
private ButtonGroup gruppen;


public Dabb()
{
lBild1 = new JLabel(new ImageIcon("Solnedg�ng.jpg"));
lBild2 = new JLabel(new ImageIcon("Vinter.jpg"));
lBild3 = new JLabel(new ImageIcon("Bl�a kullar.jpg"));

skrollytan = new JScrollPane();
panelen = new JPanel();

gruppen = new ButtonGroup();
knapp1 = new JRadioButton("Solnedg�ng",true);
knapp2 = new JRadioButton("Vinter",false);
knapp3 = new JRadioButton("Bl�a kullar",false);

delning = new JSplitPane();
delning.setLeftComponent(panelen);
delning.setRightComponent(skrollytan);

Container c = getContentPane();
c.add(delning);
delning.setMinimumSize(new Dimension(300,300));

panelen.setLayout(new BoxLayout(panelen,
BoxLayout.Y_AXIS));

gruppen.add(knapp1);
gruppen.add(knapp2);
gruppen.add(knapp3);

panelen.add(knapp1);
panelen.add(knapp2);
panelen.add(knapp3);

knapp1.addActionListener(this);
knapp2.addActionListener(this);
knapp3.addActionListener(this);

setSize(600, 400);
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
Object o = e.getSource();

if(o == knapp1)
skrollytan.setViewportView(lBild1);

else if(o == knapp2)
skrollytan.setViewportView(lBild2);

else if(o == knapp3)
skrollytan.setViewportView(lBild3);
}

public static void main(String [] argv)
{
Dabb v = new Dabb();
}
}

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ho Dab:
Hi everybody. I have got a big big problem. I can not compile my code because this message alwayes is displayed:

C:\Java\hosseindab\Dabb.java:8: cannot access JScrollPane
bad class file: .\JScrollPane.class
class file contains wrong class: javax.swing.JScrollPane
Please remove or make sure it appears in the correct subdirectory of the classpath.
private JScrollPane skrollytan;

I tried to uninstall and reinstall SDK och Textpad, but it didn't work. I even installed them on another computer, but it was the same problem. I do not know what has happened. I have tried j2SDK 1_3_1_15 and j2sdk 1_4_0_01. No use. I could compile the same files some hours ago, but now the Textpad says NO, NO, NO!!! and generates the above error. Just please help me, I don't have much time to deliver my java program.


check your classpath, it might be referencing an old SDK installation...

with out knowing how your TextPad is configured ( and that my editor is different ), I would also check to see how the macro (button ?) is setup to run your compiler...

either way, it looks like your classpath ( and possibly the path also ) is pointing to an old SDK (JDK) installation...
[ February 16, 2005: Message edited by: Liam Tiarnach ]
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That seems like a strange error. Did you name one of your own classes JScrollPane? If so, you should choose a different name as it seems to be conflicting with the standard JScrollPane from the javax.swing package.

Also, you may need to look to see if your CLASSPATH is set correctly. Most likely, CLASSPATH shouldn't be set at all.

Finally, you may want to mosey over to the GUI forum. You will be more likely to find the answer to your question from the gurus that hang out there.

HTH

Layne
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic