Bad class file: WSRP_v2_Registration_PortType ...

I've been trying to deploy a portlet to a 10.1.3.2 Portlet Container on OAS 10g without much luck. The portlet deploys correctly to the standalone OC4J within JDeveloper. Here is the error:
... \application-deployments\Portlet\Portlet\oasis\names\tc\wsrp\v2\bind\runtime\WSRP_v2_Registration_Binding_SOAP_Tie.java:930: cannot access oracle.portlet.wsrp.v2.soap.runtime.WSRP_v2_Registration_PortType_modifyRegistration_Fault_SOAPSerializer
bad class file: ... \application-deployments\Portlet\Portlet\oracle\portlet\wsrp\v2\soap\runtime\WSRP_v2_Registration_PortType_modifyRegistration_Fault_SOAPSerializer.java
file does not contain class oracle.portlet.wsrp.v2.soap.runtime.WSRP_v2_Registration_PortType_modifyRegistration_Fault_SOAPSerializer
Please remove or make sure it appears in the correct subdirectory of the classpath.
new oracle.portlet.wsrp.v2.soap.runtime.WSRP_v2_Registration_PortType_modifyRegistration_Fault_SOAPSerializer(ENCODE_TYPE, NOT_NULLABLE, SOAPVersion.SOAP_11), SOAPVersion.SOAP_11);
^
1 error
The class it is complaining about is in wsrp-stubs.jar. I've included the jar in my deployment from JDeveloper and placed it in OAS as a shared lib and import it into the classpath at deployment time. The sample portlets distributed with the portlet container deploy without issue. I'm out of ideas. Any thoughts you have would be appreciated. Thanks!
-Jason

Boing.

Similar Messages

  • UDF error: bad class file

    Hi to all!
    i faced with following problem:
    i'm trying to use in message mapping exported Java function and get following error:
    <i>Source code has syntax error:  E:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapb97a3fc699d611dcaf9d001b78d07a70/source/com/sap/xi/tf/_UserToRoleId_.java:3: cannot access kolpix.echo bad class file: E:\usr\sap\DXI\DVEBMGS00\j2ee\cluster\server0\.\temp\classpath_resolver\Mapb97a3fc699d611dcaf9d001b78d07a70\classpath\Echo_1(kolpix/echo.class) class file has wrong version 50.0, should be 48.0 Please remove or make sure it appears in the correct subdirectory of the classpath. import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.*;import kolpix.echo; ^ 1 error</i>
    There is my Java function:
    package kolpix;
    public class echo {
        public echo() {
        public static String hello(String str) {
            return "Hello "+str+"!";
    in UDF into the <b>Imports</b> textField i just put <b>kolpix.echo;</b>
    and in body function i just put <b>return echo.hello("World");</b>
    Could any one explain what does it mean and what i must do to solve the problem?
    Thx in advance.

    <a href="http://j-integra.intrinsyc.com/support/kb/article.aspx?id=183240">That info explain all</a>

  • Cannot access Graphics - bad class file

    Hey.
    When I try to compile my source I get an error saying...
    .\Man.java:146: cannot access Graphics
    bad class file: .\Graphics.java
    file does not contain class Graphics
    Please remove the files or make sure it appears in the correct subdirectory.
    It's on a different computer so that's not exactly it, but it's close enough. Compiler was working fine until the other day when i found out that all the source files were zipped up in src.zip, I had to extract Graphics.java so I could open it in emacs, and after I did that it started giving me that error message. There's nothhing wrong with my source, and I didn't move Graphics, it's still in the correct place exactly as it was, and i looked at it, all the right stuff is still inside. I'm quite confused.
    So do I have to reinstall? That would mean a massive download on my 56k and I kinda wanna carry on with my work.

    You should not need to unzip src.zip to use the Graphics class or any class that comes with j2sdk. The compiled classes are in jar files that are installed in certain directories when you install the j2sdk.
    You should only need to have a line "import java.awt.Graphics;" near the start of your source code.
    The error most likely occurred when the compiler found a Graphics.class file but inside the file is java.awt.Graphics class, not a plain Graphics class.

  • Problem in Packages while compailing the code "bad class file"

    Hi,
    I wrote the code for encrypt the password in .java file and i used package also
    i'm importing that package and i'm compiling the .java file it throws the error like this.
    regi1.java:23: cannot access EncryptPassword
    bad class file: .\EncryptPassword.java
    file does not contain class EncryptPassword
    Please remove or make sure it appears in the correct subdirectory of the claspath
    EncryptPassword enc = new EncryptPassword();
                            ^
    1 error
    EncryptPassword.java
    package encrypt;
    import java.io.UnsupportedEncodingException;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import sun.misc.BASE64Decoder;
    import sun.misc.BASE64Encoder;
    import sun.misc.CharacterEncoder;
    public class EncryptPassword  
         public EncryptPassword() { }
         public EncryptPassword instance;
         public String getEncrypt(String plaintext) throws Exception
         MessageDigest md = null;
         try
         md = MessageDigest.getInstance("SHA"); //step 2
         catch(NoSuchAlgorithmException e)
         throw new Exception(e.getMessage());
         try
         md.update(plaintext.getBytes("UTF-8")); //step 3
         catch(UnsupportedEncodingException e)
         throw new Exception(e.getMessage());
         byte raw[] = md.digest(); //step 4
         String hash = (new BASE64Encoder()).encode(raw); //step 5
         return hash; //step 6
         public EncryptPassword getInstance() //step 1
         if(instance == null)
         return new EncryptPassword();
         else
         return instance;
    }regi1.java
    import encrypt.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class regi1 extends HttpServlet
         public regi1(){     }
          public void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
            throws ServletException, IOException
            java.io.PrintWriter printwriter = httpservletresponse.getWriter();
            HttpSession httpsession = httpservletrequest.getSession(true);
            httpservletresponse.setContentType("text/html");
            try
            {     EncryptPassword enc = new EncryptPassword();
                   String Email = httpservletrequest.getParameter("email");
                   String Password = httpservletrequest.getParameter("password");
    *--- some code for database connection---*
    String insQry1 =  "INSERT INTO register (Email, Pass);
    pStmt.setString(1,Email);
    pStmt.setString(2,enc.getEncrypt(Password));     
              catch( Exception exception)
                   exception.printStackTrace();           
                   System.out.println(exception);
              httpservletrequest.getRequestDispatcher("./FileSubmit.jsp").forward(httpservletrequest,httpservletresponse);
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Multipost: http://forum.java.sun.com/thread.jspa?threadID=5225097&tstart=0
    Please continue the thread there and don't multipost!
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Javac probleme: bad class file error

    I'm new to java
    I have two classes myPoint.jav and TestPoint.java, when I compile them, I error:
    in the command line I type:
    C:\otman\java>javac -g geometry\src\myPoint.java TestPoint.java
    TestPoint.java:8: cannot access myPoint
    bad class file: c:\otman\java\geometry\src\myPoint.class
    class file contains wrong class: geometry.src.myPoint
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    myPoint p = new myPoint();
    ^
    1 error
    Can some one help me Thanks
    //Here is the class c:\otman\java\TestPoint.java
    import geometry.src.*;
         Testing my class Point
    public class TestPoint {
    public static void main(String[] args) {
              myPoint p = new myPoint();
              System.out.println("thank you very much");
              System.exit(0);
    // And here is the class c:\otman\java\geometry\src\myPoint.java
    package geometry.src;
         class myPoint members and methods of a 3D point
    public class myPoint {
         private double m_x,m_y,m_z;          // the coordinates
         public double getx() {return m_x;}
         public double gety() {return m_y;}
         public double getz() {return m_z;}
         public void setx(double x) {m_x=x;}
         public void sety(double y) {m_y=y;}
         public void setz(double z) {m_z=z;}
         public void translate(double dx,double dy, double dz) {
              m_x += dx;m_y += dy;m_z += dz;
         // Constructor ------------------------------------------------------------
         myPoint(double x,double y,double z) {
              m_x=x;m_y=y;m_z=z;
         myPoint() {
              m_x=0;m_y=0;m_z=0;
         myPoint(myPoint p) {
              m_x=p.getx();m_y=p.gety();m_z=p.getz();
    // ---------------------------------------------------------------------------------

    Thank you for the reply but still have problem.
    I created a directory classes and the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.java
    When I compile using the line command:
    C:\otman\java>javac -g -d classes geometry\src\myPoint.java TestPoint.java
    I get the error:
    TestPoint.java:8: cannot find symbol
    symbol : constructor myPoint()
    location: class geometry.src.myPoint
    myPoint p = new myPoint();
    ^
    1 error
    Now the directories look like:
    C:\otman\java\
    TestPoint.java
    classes\
    geometry\
    src\
    myPoint.class
    geometry\
    src\
    myPoint.java
    I think that myPoint was compiled without problem but TestPoint was not compiled and it gives 1 error.
    Can you help me? Thanks.<!--Session data-->

  • Bad class file error

    Hi
    I set my java home to JDK 1.4 and execute my build.It is ok.
    Then i try the same by setting JDK 1.5 as java home. build is ok.
    But now i need to use only JDK 1.4.So i set my java home as jdk 1.4 and try to execute the build.xml
    Now i got the error of class file has wrong version 49.0, should be 48.0
    I understand that the class files(49.0) which are created by JDK 1.5 and i try to execute those by JDK 1.4.
    But i donot knwo how to solve this.
    Will anybody please help me to solve?
    Thank you

    Hi
    I didnot compile java files with JDK 1.4 and 1.5 both.
    First time i use JDk 1.4. for all java files
    Second time i use JDk 1.5 for all java files.
    Finally i should use JDK 1.4. So i come to jdk 1.4 and set java home jdk 1.4 and exucute my build.xml. Then i got the bad class file error.
    Can u help me at this point?
    Thank you

  • Bad Class File error - Win2k & J2SDK1.4.0_01

    Hi,
    I am trying to run a 'Hello World' program which came with the FreeTTS package from links from the java.sun.com website, and am not able to compile the program. I get the error:
    FreeTTSHelloWorld.java:4: cannot access file
    cl.com.sun.speech.freetts.audio.Voice
    bad class file: .\cl\com\sun\speech\freetts\audio\Voice.class
    class file contains wrong class: com.sun.speech.freetts.Voice
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    import cl.com.sun.speech.freetts.audio.Voice;
    _______________________________________^
    The FreeTTSHelloWorld.java File is printed below [its embarassingly simple..]
    * Copyright 2001 Sun Microsystems, Inc.
    import cl.com.sun.speech.freetts.audio.Voice;
    import cl.com.sun.speech.freetts.audio.JavaClipAudioPlayer;
    import cl.com.sun.speech.freetts.en.us.CMULexicon;
    public class FreeTTSHelloWorld {
    public static void main(String[] args) {
         try {
         String voiceClassName = (args.length > 0) ? args[0] :
              "com.sun.speech.freetts.en.us.CMUDiphoneVoice";
         Class voiceClass = Class.forName(voiceClassName);
         Voice helloVoice = (Voice) voiceClass.newInstance();
         helloVoice.setLexicon(new CMULexicon());
         helloVoice.setAudioPlayer(new JavaClipAudioPlayer());
         helloVoice.load();
         helloVoice.speak
              ("Thank you for giving me a voice. I'm so glad to say
    hello to this world.");
         System.exit(0);
    catch (Exception e) {
         e.printStackTrace();
    I've tried a billion things, including moving around the .class files [which, by the way, i extracted myself from the .jar files which came with the FreeTTS package - is that what i'm doing wrong? if so, please tell me - ] and still nothing happens - the same error results.
    I've tried reading other cases similar to mine in the forums, but most of the things i read didn't apply to my (quite simple) situation, such as the 'package' line needing to be removed or anything like that..
    I run Win2k and have j2sdk1.4.0_01 installed on my machine
    I beg for anyone's help. Thanks in advance
    -=-Miagi-=-

    Aha!
    Extracting from the jar file might be ok, as long as the directory it's extracted into reflects the class's package name. Open the jar file using WinZip and you'll see that the files it contains are in directories that exactly mirror (including case) the package names.
    The error you're getting tells you that java is looking in .\cl\com\sun\speech\freetts\audio\Voice.class (the '.\' means relative to your current working directory) and my bet would be that the file is not there!
    You shouldn't need to extract these files at all, actually: Try deleting the files you extracted from the jar then try running your program again.
    I hope this is helpful...
    Chris.

  • BAD CLASS FILE ERROR WHEN TRYING TO CALL JAVA CLASS IN WEB-INF DIRECTORY

    I AM NEW TO THIS FORUM. PLEASE HELP ME IDENTIFY/RESOLVE THIS ERROR - bad class file: /java/tomcat/webapps/ChoiceTel/WEB-INF/classes/XYZ/SMUA.class. OTHER JSP SCRIPTS THAT CALL JAVA CLASSES DO WORK WELL.
    THE FUNNY THING ABOUT COMPILIING THIS JAVA CLASS WAS - I HAD TO A jar xvf OF activation.jar and mail.jar IN THE XYZ DIRECTORY BEFORE SUCCESSFULLY COMPILING SMUA.
    THE CALL BEING MADE FROM THE JSP SCRIPT IS AS FOLLOWS:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <BODY>
    <%@ page import="XYZ.*" %>
    <%!
    %>
    <%
    SMUA sndmail = new SMUA();
    sndmail.postMail ("[email protected]","Test Subject","What Message","[email protected]");
    %>
    </BODY>
    </HTML>

    Dude. Please don't shout. If your keyboard is like mine, it can produce both upper and lower case letters. Please use them appropriately.
    Do you have the activation.jar/mail.jar available in the WEB-INF/lib directory for this application?

  • Cannot access JScrollPane, bad class file !!!!

    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();
        }

    Your post compiles for me, no errors.
    As a guess. you have a problem classpath or mislocated or duplicate files.
    This line is especially suspect: bad class file: .\JScrollPane.class
    What is that leading period? Do you have a file named ScrollPane?
    Something else in the computer is bad, not the program.
    Try compiling from the commandline.

  • Bad class file

    This is probably a very basic issue but here it goes: I've been developing a web application in tomcat. Originally we were using the JWSDP 1.3 bundle. I decided to download tomcat 4.1.3 and tried to run the application. I keep getting "bad class errors" and something about tag pool 13 of 10. Any clue as to what is causing the problem? I think it has something to do with the classpath environment variable in windows XP, unfortunately the IT people must have changed my user rights b/c I can no longer edit/change the System variables., I've tried adding a user variable CLASSPATH with the new path to the application, but it still doesnt seem to work.
    Thanks for any help

    Because this is the only post Google returns for "netbeans bad constant pool tag", I'd like to add this (even though the post is many years old):
    The original post mentions Windows XP and CVS - so my recent experience may be relevant.
    I moved a bunch of Netbeans projects via Windows onto a Linux server to add them to a CVS repository.
    When I reentered the Projects into Netbeans all hell broke loose : for example: projects compiled clean but the IDE red-flagged them; libraries showed up on the Project Property sheets but were absent in the Libraries tab under the Project in the Projects tree. Netbeans itself appeared to be "in distress".
    I had noticed that many java sources were now double-spaced (a blank line inserted after each original line). I suspected somewhere during the journey from Windows to Linux the old carriage-return + line-feed glitch had happened. But, hey-ho, this doesn't effect the java and could be filtered out later.
    Then the moment of revelation: most of the XML and .properties files had also been double-spaced.
    So code that originally read (for example):
    javac.classpath=\
    foo:\
    bar
    now read:
    javac.classpath=\
    foo:\
    bar
    This (subtle) introduction of the extra lines ruins everything ... but once you realise what's happened, it is easily fixed !

  • Cannot acces (a class), bad class file, class file contains wrong class

    Hi,
    I am trying to implement a Java package and I've never done this before. The package is called 'randomX' and I downloaded it from here: http://www.fourmilab.ch/hotbits/source/randomX/randomX.html
    I downloaded the .tar file on my Windows Vista system, unzipped it, and dragged and dropped into(in my case): C:\Program Files\Java\jdk1.6.0_05\src\java\util
    This is also the directory where Random.java is, so I figured it went there, plus the Java Documentation says that, I think.
    The Java Docs are here: http://www.fourmilab.ch/hotbits/source/randomX/doc/
    Thanks in advance,
    Rommel.

    dcminter wrote:
    No. That's not right - you need to put the JAR file into your classpath.
    [http://en.wikipedia.org/wiki/Classpath_(Java)|http://en.wikipedia.org/wiki/Classpath_(Java)]
    If it doesn't come with a JAR file then you'll need to build it first. Sounds like that might be outside your comfort zone.Thanks for the link and the tip. I have no idea what a JAR file is, much less how to build one.
    However, the thing has a "Makefile" file. Can I build the JAR from this?
    #   Makefile for randomX package
    JAVA = /usr/java/jdk1.5.0_06
    CLASSPATH = $(JAVA)/classes:..:.
    SRC = randomX.java randomJava.java randomHotBits.java randomLCG.java \
          randomMCG.java randomLEcuyer.java randomXdemo.java
    CLASS = $(SRC:.java=.class)
    all:     
         javac -classpath ..  *java ; cp -p *class randomX
    test:
         java randomXdemo
    clean:
         rm -f *.bak *.class
         rm -rf doc
         mkdir doc
         rm -rf randomX
         mkdir randomX
    RELEASE = $(SRC) Makefile
    release:
         tar cfvz randomX.tar.gz $(RELEASE)
    html:
         javadoc -classpath $(CLASSPATH) -d doc *.java
    images:
         ( cd $(JAVA)/images ; tar cfv /tmp/ZZimages.tar . )
         rm -rf doc
         mkdir doc
         mkdir doc/images
         (cd doc/images ; tar xfv /tmp/ZZimages.tar )
         rm -f /tmp/ZZimages.tar
         touch randomX.java
    .SUFFIXES:  .java .class

  • 10 Dukes bad class file

    http://forum.java.sun.com/thread.jsp?forum=54&thread=349902&tstart=0&trange=15

    (a) I don't see any dukes, and (b) the link doesn't work. :)

  • Trying to move inner class to a class file

    Hi folks,
    I keep getting an error which puzzles me. I cut the following class (MyDocumentListener) out of an outer class (CenterPanel).
    MyDocumentListener compiles OK but...
    Now when I compile the outerclass I get the folowing error:
    C:\divelog> javac -classpath C:\ CenterPanel.java
    CenterPanel.java:54: cannot access divelog.MyDocumentListener
    bad class file: C:\divelog\MyDocumentListener.class
    class file contains wrong class: MyDocumentListener
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define
    the listener class
    ^
    1 error
    ... yes I checked, it is there..
    C:\divelog>dir m*.j*
    Directory of C:\divelog
    MYDOCU~1 JAV 936 03-04-03 11:16p MyDocumentListener.java
    ====================================================================
    MyDocumentListener tests to see if the current document has changed.
    Required fields: boolean documentWasChanged;
    import javax.swing.event.*;
    // ------ Document listener class -----------
    public class MyDocumentListener implements DocumentListener {
    public void insertUpdate(DocumentEvent e) {
    wasChanged(e);
    public void removeUpdate(DocumentEvent e) {
    wasChanged(e);
    public void changedUpdate(DocumentEvent e) {
    public boolean wasChanged(DocumentEvent e) {
    // indicate that the document was changed
    //and test before opening another file or closing the application.
    boolean documentWasChanged = true;
    return documentWasChanged;
    } // close class MyDocumentListener
    ====================================================================
    package divelog;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.lang.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    // import javax.swing.text.JTextComponent.*;
    import javax.swing.text.*;
    public class CenterPanel extends JPanel implements ActionListener
    { // Opens class
    static private final String newline = "\n";
    private JTextArea comments;
    private JScrollPane scrollpane;
    private JButton saveButton, openButton;
    private JLabel whiteshark;
    private Box box;
    private BufferedReader br ;
    private String str;
    private JTextArea instruct;
    private File defaultDirectory = new File("C://divelog");
    private File fileDirectory = null;
    private File currentFile= null;
    // public boolean changed;
    public boolean documentWasChanged;
    public CenterPanel()
    { // open constructor CenterPanel
    setBackground(Color.white);
    comments = new JTextArea("Enter comments, such as " +
    "location, water conditions, sea life you observed," +
    " and problems you may have encountered.", 15, 10);
    comments.setLineWrap(true);
    comments.setWrapStyleWord(true);
    comments.setEditable(true);
    comments.setFont(new Font("Times-Roman", Font.PLAIN, 14));
    // add a document listener for changes to the text,
    // query before opening a new file to decide if we need to save changes.
    MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
    comments.getDocument().addDocumentListener(myDocumentListener); // create the reference for the class
    scrollpane = new JScrollPane(comments);
    scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    saveButton = new JButton("Save Comments", new ImageIcon("images/Save16.gif"));
    saveButton.addActionListener( this );
    saveButton.setToolTipText("Click this button to save the current file.");
    openButton = new JButton("Open File...", new ImageIcon("images/Open16.gif"));
    openButton.addActionListener( this );
    openButton.setToolTipText("Click this button to open a file.");
    whiteshark = new JLabel("", new ImageIcon("images/gwhite.gif"), JLabel.CENTER);
    Box boxH;
    boxH = Box.createHorizontalBox();
    boxH.add(openButton);
    boxH.add(Box.createHorizontalStrut(15));
    boxH.add(saveButton);
    box = Box.createVerticalBox();
    box.add(scrollpane);
    box.add(Box.createVerticalStrut(10));
    box.add(boxH);
    box.add(Box.createVerticalStrut(15));
    box.add(whiteshark);
    add(box);
    } // closes constructor CenterPanel
    public void actionPerformed( ActionEvent evt )
    { // open method actionPerformed
    // --------- test to see if the current file was modified and give an option to save first.
    if (documentWasChanged) // add and IF filename not null
    // ----- display pop-up alert --------------------------------------------------------------
    int confirm = JOptionPane.showConfirmDialog(null,
    "Click OK to discard current changes, \n or Cancel to save before proceeding.", // msg
    "Unsaved Modifications!", // title
    JOptionPane.OK_CANCEL_OPTION, // buttons displayed
    // JOptionPane.ERROR_MESSAGE
    // JOptionPane.INFORMATION_MESSAGE
    // JOptionPane.PLAIN_MESSAGE
    // JOptionPane.QUESTION_MESSAGE
    JOptionPane.WARNING_MESSAGE,
    null);
    if (confirm != JOptionPane.YES_OPTION) //user wants to save changes
    try {
    // let user save the file
    catch(Exception e) {}
    else // let user open a new file
    } // close "if (documentWasChanged)" - display pop-up alert ----------
    JFileChooser jfc = new JFileChooser();
         //Add a custom file filter and disable the default "Accept All" file filter.
    jfc.addChoosableFileFilter(new JTFilter()); // /** found in Utils.java /*
    jfc.setAcceptAllFileFilterUsed(false);
    // -- open the default directory --
    // public void setCurrentDirectory(File dir)
    // jfc.setCurrentDirectory(new File("C://divelog"));
    jfc.setCurrentDirectory(defaultDirectory);
    jfc.setSize(400, 300);
    jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    Container parent = saveButton.getParent();
    //========================= Test Button Actions ================================
    //========================= Open Button ================================
    if (evt.getSource() == openButton)
    int choice = jfc.showOpenDialog(CenterPanel.this);
    File file = jfc.getSelectedFile();
    // --------- change test was here -----------
    /* a: */
    if (file != null && choice == JFileChooser.APPROVE_OPTION)
    String filename = jfc.getSelectedFile().getAbsolutePath();
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    try
    { //opens try         
    comments.getLineCount( );
    // -- clear the old data before importing the new file --
    comments.selectAll();
    comments.replaceSelection("");
    // -- get the new data ---
    br = new BufferedReader (new FileReader(file));
    while ((str = br.readLine()) != null)
    {//opens while
    comments.append(str);
    } //closes while
    } // close try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Open command not successful:" + ioe + newline);
    } // close catch
    // ---- display the values of the directory variables -----------------------
    comments.append(
    newline + "The f directory variable contains: " + f +
    newline + "The fileDirectory variable contains: " + fileDirectory +
    newline + "The defaultDirectory variable contains: " + defaultDirectory );
    else
    comments.append("Open command cancelled by user." + newline);
    } //close if statement /* a: */
    //========================= Save Button ================================
    } else if (evt.getSource() == saveButton)
    int choice = jfc.showSaveDialog(CenterPanel.this);
    if (choice == JFileChooser.APPROVE_OPTION)
    File fileName = jfc.getSelectedFile();
    // -- get the current directory name -------
    // public File getCurrentDirectory( );
    File f=new File(System.getProperty("user.dir"));
    fileDirectory = jfc.getCurrentDirectory();
    // -- remember the last directory used --
    if (defaultDirectory != fileDirectory)
    {defaultDirectory = fileDirectory;}
    //check for existing files. Warn users & ask if they want to overwrite
    for(int i = 0; i < fileName.length(); i ++) {
    File tmp = null;
    tmp = (fileName);
    if (tmp.exists()) // display pop-up alert
    //public static int showConfirmDialog( Component parentComponent,
    // Object message,
    // String title,
    // int optionType,
    // int messageType,
    // Icon icon);
    int confirm = JOptionPane.showConfirmDialog(null,
    fileName + " already exists on " + fileDirectory
    + "\n \nContinue?", // msg
    "Warning! Overwrite File!", // title
    JOptionPane.OK_CANCEL_OPTION, // buttons displayed
                        // JOptionPane.ERROR_MESSAGE
                        // JOptionPane.INFORMATION_MESSAGE
                        // JOptionPane.PLAIN_MESSAGE
                        // JOptionPane.QUESTION_MESSAGE
    JOptionPane.WARNING_MESSAGE,
    null);
    if (confirm != JOptionPane.YES_OPTION)
    { //user cancels the file overwrite.
    try {
    jfc.cancelSelection();
    break;
    catch(Exception e) {}
    // ----- Save the file if everything is OK ----------------------------
    try
    { // opens try
    BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
    bw.write(comments.getText());
    bw.flush();
    bw.close();
    comments.append( newline + newline + "Saving: " + fileName.getName() + "." + newline);
    break;
    } // closes try
    catch (IOException ioe)
    { // open catch
    comments.append(newline +"Save command unsuccessful:" + ioe + newline);
    } // close catch
    } // if exists
    } //close for loop
    else
    comments.append(newline + "Save command cancelled by user." + newline);
    // ========= }
    } // end-if save button
    } // close method actionPerformed
    } //close constructor CenterPanel
    // <<<<<<<<<<<<<<<<<
    // <<<<<<<<<<<<<<<<< MyDocumentListener class was here <<<<<<<<<<<<<<<<<
    // <<<<<<<<<<<<<<<<<
    } // Closes class CenterPanel

    You didn't put your MyDocumentListener class in the package divelog.
    Add
    package divelog;to the top of MyDocumentListener.java and recompile.

  • How do i access a third party .class file

    Hi,
    I am new to both java and enterprise 8, and would greatly appreciate some help.
    I have a third party .class file and want to include it in a project so i can call it's methods etc. I can access it by creating an object as follows
    thirdPartyClass tpc= new thirdPartyClass();and then create a .class file of my own using javac at the command line without any probles, but if I use the same code in enterprise 8 it reports an error stating "cannot access MyProjectName.thirdPartyClass" could someone please tell me how to reference this file as so far I have not been able to find anything.
    Thanks for any help.

    Thanks for the suggestions it appears I was doing more or less the right things but miss reading the error message:
    Cannot access keyword.classes.thirdPartyClass
    bad class file C:\java\keyword\classes\thirdPartyClass
    class file contains wrong class: thirdPartyClass
    please remove or make sure it appears in the correct subdirectroy of the classpath.
    While looking I have found that the classes do not contian src folders of Javadoc so I will go see if the third party can supply a Jar file or similar.
    Thanks

  • Bad class problem

    Hi
    I have a Package and in my source file I am using it..but when I compile my source file, it gives error:
    Cannot access ....
    Bad class file .......
    Class file contains a wrong class ...
    Plz remove or make sure it appears in correct subdirectory...
    here not that
    [ ALL PATH IS correct to class I am using in my program]

    The source file must have the same name as the class that is in it:
    public class MyClass
    must be in a file:
    MyClass.java
    And remember that Java is case sensitive, so
    public class myClass can't be in MyClass.java

Maybe you are looking for

  • Report Takes Too Long Time

    Hi! I am in troubble following is the query SELECT inv_no, inv_name, inv_desc, i.cat_id, cat_name, i.sub_cat_id, sub_cat_name, asset_cost, del_date, i.bl_id, gen_desc bl_desc, p.prvcode, prvdesc, cur_loc, pldesc, i.pmempno, pmname, i.empid, empname F

  • Open Pages with Thumbnails Always

    Hi, Im new to iWork, and the transition from MS 2007 is dreadful; but I am trying to learn many of the things I used to use in MS 2007. My question is: Is there a way to have " View>Page Thumbnails " always activated - like at startup of Pages and as

  • Why does my button no longer work in Flash Player 8?

    Hi, I have built a site in Flash MX a while ago. Now I'd like to upgrade things a bit while testing the new Adobe Flash CS3. To be able to use a new function ("anti-alias for readability") the program warns me that "this feature is not supported by F

  • MPD + Pulseaudio problem

    Hey guys, I'm having trouble with mpd coupled with pulseaudio when trying to play surround sound (5.1) songs. The issue seems to be that mpd completely ignores my front-right speaker - nothing comes out of it. deadbeef and amarok can play the songs p

  • ITunes download error code: stopped (err = -5000)

    hello - I recently did a reinstallation of 10.8.5 and migrated all my user data via the Migration Assistant this worked all very smoothly, however since then I am not able to download podcasts in iTunes any longer, I can listen to the stream, however