Problem in saving entire class in a file

I have a program which saves entire classes in a file:
try
FileInputStream tiedosto =
new FileInputStream(fn);
ObjectInputStream syote =
new ObjectInputStream(tiedosto);
l = (Lokidata)syote.readObject();
syote.close();
catch (Exception e)
JOptionPane.showMessageDialog(this, "ei onnistu "+fn);
System.err.println(e);
this works fine until i change to different java runtime version. If I save in runtime version 6-5, I cannot read
the class with runtime version 6-6. The same with runtime 6-3. These I have tested and it seems that I have to read with the same runtime version which I have used in saving.
Can I overcome this somehow? How can i determine in NetBeans which jre NetBeans uses?
Urpo Pietilä
[email protected]

Thank you for good advice. After reading the article I decided to save my class as text file and convert it back to data after read the text.
Netbeans did not warn about missing import although I had the class implemented as serializable.
Urpo

Similar Messages

  • Having problems in creating a class with name File.

    I want to compile a new class with class name as File, i have made it part of a new package also but still i am getting this error
    "File.java:2: CustomFile.File is already defined in this compilation unit
    import java.io.File;
    ^
    File.java:6: cannot resolve symbol
    symbol : constructor File ()
    location: class java.io.File
    inFile = new java.io.File();
    ^
    2 errors"
    Here is the source code of the file:
    package CustomFile;
    import java.io.File;
    public class File {
    private java.io.File inFile;
    public File(){
         inFile = new java.io.File();
         System.out.println("hi file");
    }

    Any help is appreciated.
    I want to compile a new class with class name as File,
    i have made it part of a new package also but still i
    am getting this error
    "File.java:2: CustomFile.File is already defined in
    this compilation unit
    import java.io.File;
    ^
    File.java:6: cannot resolve symbol
    symbol : constructor File ()
    location: class java.io.File
    inFile = new java.io.File();
    ^
    2 errors"
    Here is the source code of the file:
    package CustomFile;
    import java.io.File;
    public class File {
    private java.io.File inFile;
    public File(){
         inFile = new java.io.File();
         System.out.println("hi file");

  • Saving a Class Object to file

    Hi guys.
    If i have a Class object (an instance of "java.lang.Class"), is it possible to write that object to file so i end up with a .class file somewhere on my computer?
    Any help appreciated.
    Thanks
    -Nonameo-

    Hope i didnt cause any conflict here guys.
    Just to clear things up:
    when i wrote my original request, i hadnt even heard of Serialization so that was not my request. After being told about it, i tried it out but the output file produced didnt work like a normal .class file.
    I havent yet gone into researching the byte-code library idea, but it does sound promising.
    I think ejp grasped what i was getting at. Sorry if i confused anyone with my request, i didnt realise it could be interpreted in multiple ways.
    Thanks again
    -Nonameo- (OP)
    Message was edited by:
    Nonameo

  • Problem while saving list output as local file.

    Hi Gurus!
    i want to save the list output of classical report into excel but complete data is not coming into excel file.
    [SYSTEM - > LIST ->SAVE ->  LOCAL ->SPREADSHEET ]
    when same output is transfer to unconverted file [notepad ] then completed data is coming.
    please help me ,
    points sure!
    Rahul
    Message was edited by:
            rahul deshmukh

    Yes Rahul, I know that and you have to do the formating. This is how you can do.
    Open the unconverted file in Excel format.
    Select the first column and then goto Data - Text to Columns , a pop up will come.
    Select Delimited, then press next.
    Then selct the delimeter that is used in the unconverted file to seperate two columns. Say for example if ' | ' is used then in others write ' | ' and press next.
    IN the data preview section select all the columns and then select text radio button on top and press finish finally.
    Now u will get the proper format of the file. Delete all the empty rows and columns that u don't want.
    Reward if you find it useful.
    Regards.
    Akhil.

  • Saving query result to a file

    Hi,
    I have a sql*developer version 1.5 but i am getting a problem while saving query result to a file. When i click on "script output "-> "file icon" nothing is showing.
    Can anyboby guide me whether its a bug or some other settings are required.
    I have oracle 10.2.0.3 working on linux.
    Thanks & regards
    Girish

    I am getting the same thing and as far as I know it is a bug.
    As a workaround, you can either copy the contents of the script output or run the query as a statement (F9) instead of as a script (F5) and export the query results from the results tab.

  • Problem with saving a pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21).

    Need advice on a saving file issue. I'm having problem with saving a .pdf file to computer. Continually get an error message " This document could not be saved. There was a problem reading this document (21). This is new as this error message just recently started to pop-up.

    More information about this issue can be found here:
    https://forums.adobe.com/thread/1672655
    A "quick" fix that worked for me was to uninstall Adobe... then download the base install for Adobe Reader 11.0.
    Then download each of the individual updates and run them sequentially. 
    I've installed back up to the last security update which is version 08 and have been able to do normal Save As operations.
    You will have to disable automatic updates in order to stay at version 08 until Adobe resolves this issue in a later release.
    http://www.adobe.com/support/downloads/product.jsp?product=10&platform=Windows
    Adobe Reader 11.0 - Multilingual (MUI) installer    AdbeRdr11000_mui_Std
    Adobe Reader 11.0.01 update - Multilingual (MUI) installer    AdbeRdrUpd11001_MUI.msp
    Adobe Reader 11.0.02 update - All languages    AdbeRdrSecUpd11002.msp
    Adobe Reader 11.0.03 update - Multilingual (MUI) installer    AdbeRdrUpd11003_MUI.msp
    Adobe Reader 11.0.04 update - Multilingual (MUI) installer    AdbeRdrUpd11004_MUI.msp
    Adobe Reader 11.0.05 security update - All languages    AdbeRdrSecUpd11005.msp
    Adobe Reader 11.0.06 update - Multilingual (MUI) installer    AdbeRdrUpd11006_MUI.msp
    Adobe Reader 11.0.07 update - Multilingual (MUI) installer    AdbeRdrUpd11007_MUI.msp
    Adobe Reader 11.0.08 security update - All languages    AdbeRdrSecUpd11008.msp

  • Problem in saving modified rtf file in jsp

    hi,
    I have [b]problem in saving modified rtf file in jsp. My scenario is like this:
    I need to open rtf file in jsp and allow user to modify it, after user modifies rtf file in browser, user will press send button. After user pressing send button rtf has to be saved into destination directory(the directory from which its been fetched. I appreciate if any one could send me relevant code for the same.
    thanks
    ram

    1) RTF is not opened in your browser, but in an application that is set to handle the file type (like Word or Wordpad)
    2) from the web you have no control over what that application does
    3) conclusion: what you want is not possible using the web
    Other than that, asking for code without showing that you put some effort into the problem yourself is a sure way of getting flamed. You should know that by now, since you registered more than 2 years ago...

  • I have an MS word doc saved from a Macbook in my flash drive. Now i want to print this from an IBM compatible laptop. problem is -- I can't access the file. Please help.

    I have an MS word doc saved from a Macbook Pro on m flash drive. Now i want to print
    th same doc from an IBM Compatible laptop. Problem is, I can't access the file. Please help.

    I suggest you post your question on Microsofts own forums for their Mac products as it's their software you're having issues with:
    http://answers.microsoft.com/en-us/mac

  • Problem while saving an object under a dev class

    hi all,
            Here is a problem while saving an object under a development class.... I created a Z program (ZSORDER)  through SE38 and while i was saving that Z program under a development class called SALES it shows an error message like  <b>" customer object program ZSORDER can't be assigned to the package SALES"</b>..... can any one can explain what is the problem....

    hi,
    you should have created your package starting with the letters "Y" or "Z".
    you have created it with the letter "s". SALES.
    's' is reserved to be used by SAP.
    so create the package  with the letters 'y' or 'z' like 'ysales' and you wont be getting that problem.
    try it.
    warm regards,
    Hari Kiran

  • Problems with saving a file

    Hello,
    Im having problems with saving files on my computer, from Mail and Safari. I have 900gb free diskspace, but i simply cant save anyhow, it says my disk is full.
    Have i accidentally locked something up?
    Regards,
    Niclas

    Run disk utility on your hard drive to repair your permissions.  http://support.apple.com/kb/HT1452

  • Problems on Saving a text file

    the "Java Programming" forum is more active compare to "CLDC-MIDP" and "WTK" forum that's why I posted my problem here just case in MIDP programmer dropped by.
    My problem is my phone (Nokia 6260) contains MIDP2.0, the problem is, it has no JSR-75/File Connection API... my application is runs perfectly on my WTK2.2 because it has a JSR-75 jar file...
    but it wont run on my Nokia 6260 phone because of FileConnection API is missing... my question is, is it possible to install the JSR75 on my mobile Nokia6260 phone?
    again, my apology for posting my grievance here...
    thank you so much...

    You can do it by upgrading your firmware .
    If there is upgraded firmware supporting JSR75 then it might solve your problem.

  • The File class ignores the file.separator system property?

    I am saving the pathname of a file to a String using:
    String pathString = myfile.getAbsolutePath();
    This gives me e.g. "D:\Java\Projects\myfile.txt" on Windows XP
    If I want to save this value to a properties file, then load it in a new invocation of the program, this string will not be recognised as a valid pathname because of the backslashes.
    So I want to use forward slashes as the file separator char.
    I tried:
    System.setProperty("file.separator","/");
    However, this setting seems to be ignored by the File class, as I still get the same string with backslashes from the getAbsolutePath() method.
    Can anyone help please?

    Yeah... I've used that before. Never recalled having problems. I can't, however, recall if there were file paths saved.
    Just tested with this:
    import java.io.*;
    import java.util.*;
    public class Props {
         public static void main(String[] args) {
              try {
                   Properties p1 = new Properties();
                   p1.put("file", new File("C:\\test\\Props.java").getAbsolutePath());
                   FileOutputStream out = new FileOutputStream("Props.properties");
                   p1.store(out, null);
                   out.close();
                   FileInputStream in = new FileInputStream("Props.properties");
                   Properties p2 = new Properties();
                   p2.load(in);
                   System.out.println("p1: " + p1.getProperty("file"));
                   System.out.println("p2: " + p2.getProperty("file"));
              } catch(Exception e) {
                   e.printStackTrace();
    }created this:
    #Tue Jun 21 10:53:38 EDT 2005
    file=C\:\\test\\Props.java

  • Saving ALV Grid to Local File issue - Missing half of the report

    Hi Experts, Good Day.
    I have developed an ALV Grid report using class CL_SALV_TABLE which displays 200 Columns and 100+ rows/records. It is displaying well, but when I am saving the output into local file (any type) there only 98 columns are downloading and remaining all the columns are missing.
    I would like to know whether there is any restriction for number of columns or what might the problem for it. How can I download all the columns into local file.
    Thanks in Adv.
    Vijay

    Hi,
    Thanks for your response. Even though there are multiple ways to send data to local file I believe all three are same. And even I am facing same issue all the ways. Only 98 Columns data is getting downloaded into Files (it might be .txt, .xls, etc.).
    After downloading first 98 Columns, I am hiding the downloaded columns and again I am downloading remaining columns. Then I am merging in the Excel file. This is very complicated for the End-User. So, please help me out.
    I have used only following methods for displaying ALV.
    For initial object/instance:
    CL_SALV_TABLE=>FACTORY,
    For ALV functions:
    CL_SAVL_TABLE->GET_FUNCTIONS,
    CL_SALV_FUNCTIONS_LIST->SET_ALL,
    For Column heading and Optimized width:
    CL_SALV_TABLE->GET_COLUMNS,
    CL_SALV_COLUMNS_TABLE->SET_OPTIMIZE,
    CL_SALV_COLUMNS_TABLE->GET_COLUMN,
    CL_SALV_COLUMN->SET_SHORT_TEXT,
    To display grid:
    CL_SALV_TABLE->DISPALY.
    - Thanks
    Vijay

  • I saved my Form Central spreadsheet file once as a excel file but it will not allow me to save it a second time as an excel file.  It says that I cannot complete this action because the file me be open in another application, but it is not open in another

    I saved my Form Central spreadsheet file once as a excel file but Forms Central will not allow me to save the file a second time as an excel file.  I am informed that I cannot complete this action because the file me be open in another application, but it is not open in another application. What is the problem, and how do I solve the problem.  Thank you. Jeff

    First check the version of the document with Jongware's script "Identify.jsx" (ExtendScript/JavaScript).
    You can find it here:
    [Ann] Identify Your InDesign File
    If it is CS 5.5 or above, you need someone to open it in the version the script says and export an IDML representation from that. Another way would be to install a 30days version of CS6 or above (CC) and do it yourself.
    In regards of the script showing a result for InDesign files higher than CS6:
    CS7 = CC v9
    CS8 = CC v10 = CC-2014 or CC2014.1
    Uwe

  • How to Print The Entire Course as PDF file from "The Sun Learning CD-ROM"

    Is anyone able to print entire course as PDF file? I'm currently learning Solaris 10 OS and trying to print the full course/module on CDS-200-S10: Intermediate System Administration for Solaris 10 Operating System CD but unsuccessful.
    It seems like I can only print individual page from each module. I have Adobe Acrobat installed on my system. Your helps is greatly appreciated.

    Hi Ankur Ver,
    This forum is to discuss problems of Windows Forms. Your question is related to itextsharp, it is the third-party library.
    You can consider contacting the official for supports, Thanks for your understanding.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for