• Register
0 votes
148 views

Problem :

I am having following warning message.

The serializable class does not declare a static final serialversionuid field of type long

I would like to understand and resolve the issue. Can somebody explain me this issue with simple words? I know what OOPs is

Please find below my code for your reference :

import java.awt.*;
import javax.swing.*;
public class HelloSwing extends JFrame {
JTextArea m_resultArea = new JTextArea(6, 30);
public HelloSwing() {
//... Set initial text, scrolling, and border.
m_resultArea.setText("Enter some more text to see scrollbars");
JScrollPane scrollingArea = new JScrollPane(m_resultArea);
            scrollingArea.setBorder(BorderFactory.createEmptyBorder(10,5,10,5));
// Get the content pane, set layout, add to center
Container content = this.getContentPane();
content.setLayout(new BorderLayout());
content.add(scrollingArea, BorderLayout.CENTER);
this.pack();
        }
public static void createAndViewJFrame() {
JFrame win = new HelloSwing();
win.setTitle("TextAreaDemo");
            win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
win.setVisible(true);
}
     
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable(){
public void run(){
createAndViewJFrame();
                }
            });
        }
}
6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

Please find below the solution on your problem :

You can configure your IDE in two ways:

·To ignore the error message instead of giving a warning.

·To auto generate an id

It can cause the problem only if you are serializing objects and deserializing them in a different place OR time where the class has changed, and it will not result in freezing, but in InvalidClassException

9 7 4
38,600 points

Related questions

1 vote
1 answer 4 views
4 views
Problem: Can someone please help fix this uncaught error : private static final long serialversionuid = 1l;
asked Mar 31 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 730 views
730 views
Problem : I am trying to learn Java, I am very newbie however I wanted to know what I do to get the "run" it. I am facing below error: Static Error: This class does not have a static void main method accepting String[]. Below is my code: public class MyCaneirinho { public static void mycontar ... { System.out.println(j + x + y); } else { System.out.println(j + x + y + z); } } } } // MyCarneirinho
asked Dec 10, 2019 alecxe 7.5k points
0 votes
0 answers 3 views
3 views
Problem: I'm having problems during my learning as I mentioned in my question above, I try to find on web search but I can't get proper information, can you help me to continue my project?
asked Mar 21 shamimkhan 15.1k points
0 votes
1 answer 22 views
22 views
Why static and final are not compatible together in Java ?
asked Sep 22, 2020 rm02 310 points
0 votes
1 answer 3 views
3 views
Problem: I need someone’s help to fix it .local class incompatible: stream classdesc serialversionuid
asked Mar 22 Ifra 24.4k points
0 votes
1 answer 80 views
80 views
Problem : In Java, I want to have something as below : class MyClazz<T> {  static void doIt(T object) {    // More code  } } But I face below error &ldquo;Cannot make a static reference to the non-static type T&rdquo; I am unable to understand ... about a subject. Could someone clarify if such the use is possible, by the similar manner? Also, why was my original attempt went unsuccessful?
asked Jan 21, 2020 jwilliam 3.9k points
0 votes
1 answer 15 views
15 views
Does anyone have any ideas? Any help is appreciated.
asked Feb 11 TeamScript 13.5k points
0 votes
1 answer 21 views
0 votes
1 answer 3 views
3 views
Problem Please tell me the correct choice for the following question: How to overcome &ldquo;DateTime.DateTime, not JSON serializable&rdquo;?please explain the.Thanku
asked 6 days ago neeraj 10.5k points
1 vote
1 answer 1K views
1K views
Problem: I have a data frame to count my daily costs and when I try to input this to my cost using python script it always shows the error: TypeError: Object of type 'int64' is not JSON serializable The script I wrote is: ... update_list.append(update_data) all_data_cursor = all_datapull.costforce_login() all_data_cursor.bulk.Account.update(update_list) Can anyone help me out to fix this thing.
asked Apr 7, 2020 LizzyM 6.1k points