Executing .CLASS file

Hello,
I recently had my machine reimaged and I'm trying to configure it to execute Java class files from the command prompt. After manipulating the PATH and CLASSPATH system variables I was able to get it to the point where I can compile .JAVA source code, but I still can't execute the file.
The source is named NotesExport.java. I can issue the javac NotesExport.java command successfully, but when I issue java NotesExport, it gives the following error:
Can't find class NotesExport
I've confirmed that the NotesExport.class file is indeed there so I'm confused as to why it can't be found.
Does anyone know what's wrong here?

Yes, the problem is with the import line below:
import lotus.notes.*;
public final class NotesExport extends NotesThread{ <rest of code> }I was told that in order for the import command above to work, I need to add the path to the notes.jar file in my classpath (c:\notes\notes.jar). I've done that, but it still doesn't work. I get the following error messages when I compile this code in JCreator:
--------------------Configuration: JDK version 1.1.8 <Default>--------------------
C:\SasJava\NotesExport.java:9: Package lotus.notes not found in import.
import lotus.notes.*;
       ^
C:\SasJava\NotesExport.java:11: Superclass NotesThread of class NotesExport not found.
public final class NotesExport extends NotesThread{
                                       ^
2 errors
Process completed.I'm assuming that the NotesThread class is bundled into that notes.jar file, but I'm not sure. I'm also not sure what that lotus.notes.* is all about... I figured that package was part of the notes.jar file too. Since it apparently isn't finding the notes.jar file, even though I tell it where it is in my CLASSPATH, nothing is working!

Similar Messages

  • Executing class files

    Pls help I got following error while executing class file.
    Exception in thread main java.lang.NoClassDefFoundError : main
    Edited by: Mubin_Attar on May 19, 2008 6:34 PM

    Mubin_Attar wrote:
    Pls help I got following error while executing class file.
    Exception in thread main java.lang.NoClassDefFoundError : main
    Edited by: Mubin_Attar on May 19, 2008 6:34 PMIt appears that you typed "java main" or something like that, which means you have a file named "main.class". This is telling you that you don't have such a file.

  • Execute *.class file by DoubleClicking

    I use WinXP.and i tryed to let my OS execute *.class file by Doubleclicking. to do so i used Windows Explorer->Tools Menu->Folder Options Menu->File Types Tab and then i registered CLASS file type. on its open action i wrote "C:\JAVA_HOME\jdk15\jre\bin\java.exe" "%1". but when i try to execute *.class file its gives error.
    i guess that windows executes the command "%JAVA_HOME%\bin\java.exe C:\aaa.class" when i double click aaa.class file icon. So the java.exe tryes to execute "class.class" file of "aaa" package. Is there any way to cut ".class" of the command.
    otherwise is there another way to do that?

    This way works in XP:
    Create a batch file "runJ.bat" with these contents:
    @ECHO OFF
    rem This batch program is invoked when a .class file is double-clicked.
    rem This is done by registering the extension .class and associating
    rem this file with its opening. The expression %~n1 removes the path
    rem and the .class suffix, leaving just the filename.
    java %~n1
    pauseAnd create the file association using the following in the open command:
    "<path>\RunJ.bat" "%1"

  • Execute Class file

    Is is possible execute the class file without the intepreter?
    If can , how to do?
    Can I convert the class file to exe file ?

    Is is possible execute the class file without the
    intepreter?No, only if you run on a platform that understands the java bytecodes without an interpreter.
    Can I convert the class file to exe file ?Yes, search for java exe(cutable) in the forum or the web. You need a program to do this conversion, but then your program will only run on windows.

  • Error when trying to execute .class file.

    Hello,
    I downloaded jdk 1.5 from the official java website and have installed it properly. I tried compyling my java program and it gets compilde. But when I try to execute it I keep getting the error "Exception in thread "main" java.lang.NoClassDef Found Error". Please help me .........

    It's because java can't find one (or more) of your .class files. You have to tell it by passing the correct classpath to java.exe.
    Read about the classpath and java launcher here:
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/index.html
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html
    Message was edited by:
    Loko
    Because:
    Something is definitely wrong with the formatting

  • Unable to Execute Class File

    Dear All,
    I am Using JDK1.3 in Microsoft Windows 2003 sever.
    I had Created a test program as follows, Which is Saved in the BIN directory Named t.Java
    class t
    public static void main (String arg[])
    {     System.out.println ("Test Prorgram ");     }
    When I compile the above Code it Compiled Successfully.
    But, When I try to execute the class
    It reports the ClassNoDefFoundException.
    It had Try the following Set Classpath = C:\jdk1.3\bin; command, still I have the same problem.
    How can I Execute the Class File.?

    Run it like this:
    java -classpath . tSome useful resource:
    Java's code conventions: [http://java.sun.com/docs/codeconv/]
    What is the classpath really: [http://en.wikipedia.org/wiki/Classpath_(Java)]
    Also, Java 1.3 is really old. I recommend to download and install Java 1.5 or 1.6.

  • Windows Trick: Executable Class Files

    This is in "new to java" for a reason.
    I dont want to be flamed for posting something obvious, lol.
    Its just a simple trick to fire up programs by double
    clicking a class file. This is for minor cases that dont warrant an
    executable JAR.
    I was never able to get this working before but i stumbled on this
    tech tip that made it all possible:
    http://blogs.msdn.com/ben/archive/2007/03/09/path-manipulation-in-a-batch-file.aspx
    HOW TO:
    Create a new text file with the following contents:
    @title %~n1
    cd "%~dp1"
    java -cp . %~n1
    Alternately, if you dont want to see the command window at all (like
    with javaw) use this text INSTEAD:
    start "%~n1" /D"%~dp1" javaw -cp . %~n1
    Save this file as "javalauncher.bat" (it has to have a .bat extension).
    Save it into a reliable folder. The java folder is a good place
    for this. On my computer that is: C:\Program Files\Java\jdk1.6.0
    FINALLY:
    (1) Open Windows Explorer (or "My Computer")
    (2) Go to Tools -> Folder Options -> File Types
    (3) Find the CLASS extension (or create it by hitting the "New" button)
    (4) Select it and hit "Advanced"
    (5) Select "open" action and hit "Edit" or create a new action
    Action: open
    Application Used To Perform Action: C:\Program Files\Java\jdk1.6.0\javalauncher.bat "%1"
    Explanation:
    The action variable %1 returns a full path. Passing this to java
    with "java %1" doesnt work so I gave up on this a long time ago.
    Unfortunately the batch file file path manipulation trick doesnt work
    in the action window "java %~f1" so a batch file is necessary.
    Also anyone trying to condense these lines:
    cd "%~dp1" java -cp . %~n1 into this:
    java -cp "%~dp1" %~n1 ... that will NOT work
    if you are in a folder with spaces in the path.
    For some reason java doesnt recognize quoted
    paths that end in a path separator:
    java -cp "C:\a space\" Program <--- fails
    Why not a simple exe? With this method you can pop into the java
    launcher bat file and make little tweaks if you ever have to.
    Plus a SINGLE line of text is better then opening up MSVC++
    creating an entire project, compiling etc etc.
    Why not a JAR? This is just for the simple programs beginners would
    write (an intermediate step between the command line and an IDE!).
    Why else is this a good idea? Beginners learn the basics of BAT files
    and what they can do. This technique is extensible to a Compile and
    Jar Me Up! action.
    Also, you can create actions involving Java programs called from a
    bat for more complicated things. For example: right click on a .JAVA file
    and it will write the manifest file and jar up every java file in the folder.
    Also, why not. It takes 2 minutes?
    EDIT: quotes missing in the start command fixed

    until recently, I had a .bat file successfully executing one of my class files.
    Something changed, and not I get this error.
    Exception in thread "main" java.lang.NoClassDefFoundError: BatchStandaloneso my basic question is, what all would I need to have on the CLASSPATH or PATH again to have this work? I am thinking that's what got disrupted.
    Because now it doesn't work, and I seem to believe I inadvertently changed that. I may have added a jar file to my commons/lib dir in Tomcat, but that shouldn't have altered it so drastically.
    Thanks.

  • Executing class files from a Java App dynamically

    Hi!, Is there any way i can execute java .class files from my Java Application dynamically. I know that java uses Dynamic method Invocation. Is that true of class files generated using some other language compiled for the JVM.
    In my case i would like to make a Web browser that interprets HTML and also java applets embeded in them. I would like to use the JRE of the platform execute the applets for me rather than writing the code for my Browser to interpret the class files.
    Thanks in Advance.

    You just need a custom class loader to bring these applets into your JVM.
    http://developer.java.sun.com/developer/onlineTraining/Security/Fundamentals/magercises/URLClassLoader/index.html
    Then you can use the methods of java.lang.Class to create an instance of such a class. As soon as you have it, you can just treat it as a regular Applet and invoke init(), stop() etc. appropriately.
    If you want to execute anything else than conventional Applets, you might consider reflection to find out about methods implemented:
    http://java.sun.com/docs/books/tutorial/reflect/index.html

  • Execute Class Files (.exe)

    Hi!
    How could I change a java program into a execute program ( .exe) under Windows NT?
    Thanks

    Look into the jar tool.
    http://developer.java.sun.com/developer/onlineTraining/Programming/BasicJava2/jar.html#jar

  • Class not found error while executing jar file

    I have written a java code in which i am connecting to database....when i run the class file using......java class_filename it works........
    but when i run the jar file using .......java -jar jar_name ...yi gives me the error as 'Class not found'......
    can anybody help me please......
    Thanks and Regards,
    Siddhesh

    that class is part of jar file.....in classpath i have included zip files for jdbc ...to get databse connection.....and the jar being executed ................still it gives the error ClassDefnotfound which i think is due to database connection problem.....the exception is raised while.....
    Class.ForName("Driver_name").newInstance();/ This driver is present in zip files that i have added in classpath....
    above statement doesn,t giv error while i execute the class file............but exception while executing jar file only..
    Thnaks and regards,
    siddhesh

  • Executable JAR file: Could not find the main class.

    Hello,
    I have a problem with making an executable JAR file.
    I have written a JAVA program that consists of five different classes of which User.java is the main class and I have saved a text document with Main-Class: User and a blank line after that.
    If I try:
    jar cmf MainClass.txt User.jar User.class Beheerder.class Operator.class Manager.class MaakVisueelSchema.class
    it makes a executable jar file which actually works! :)
    But when the Operator class trys to open the MaakVisueelSchema class the screen stays blank.
    I can run MaakVisueelSchema with java MaakVisueelSchema.
    So I tried to make an executable JAR that consists only of MaakVisueelSchema, the same way as I did for User:
    Main-Class: MaakVisueelSchema
    jar cmf MainClass.txt MaakVisueelSchema.jar MaakVisueelSchema.class
    Then I get the error message:
    Could not find the main class. Program will exit.
    from the Java Virtual Machine Launcher.
    The big difference between MaakVisueelSchema and the other classes is that MaakVisueelSchema contains a PaintComponent method and an ComponentListener. Is it possible that one of those creates the error?
    Can anyone help me with this problem?
    Thanks in advance!
    Bye!

    Yes,
    I tried:
    jar xvf MaakVisueelSchema.jar
    and it returns:
    META-INF/
    META-INF/MANIFEST.MF
    MaakVisueelSchema.classN/G. You need to manually create a manifest file in a text editor, have it point to your main class, and enter it in your jar command as an argument.

  • When i executed this class file  i am getting runtime errors

    when i executed this class file i am getting runtime errors
    code is :
    import java.awt.event.*;
    import java.awt.*;
    public class Test extends Frame
    java.awt.Window w;
         TextField t;
         Test()
         t=new TextField(20);
         add(t);
         addWindowListener(new WindowAdapter()
                             public void windowDeactivated(WindowEvent ev)                               {                    
                                  w.toFront();          
                                  System.out.println("hai");
         setSize(300,300);
         setVisible(true);
    public static void main(String args[])
    Test t =new Test();
    after executing that class i am getting this errors
    Exception occurred during event dispatching:
    java.lang.NullPointerException:
    at WindowEventDemo.windowActivated(WindowEventDemo.java:76)
    at java.awt.Window.processWindowEvent(Window.java:612)
    at java.awt.Window.processEvent(Window.java:576)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Container.dispatchEventImpl(Compiled Code)
    at java.awt.Window.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventQueue.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
    if anybody know how to pls help me

    You are using w that you have not done anything with.
    Add following code to the begining of your cinstructor:
    w = this;
    Then it should work.
    //Anders ;-D

  • I created a class file , if i execute this class file it has to be always o

    i created a class file , if i execute this class file it has to be always on top if i open any other programms or applications then also this class file application has to show me on the screen top , i meas ti has to show me first and behind all applications which i opend other applications
    How to do this please help me
    bhaskar

    It sounds like you might be able to write a .bat script to run the application, create a desktop icon for that and set its properties so it runs in the background.

  • Executing java.class files

    From julesh1
    To whom may help me:
    I'm new to java.
    I'm currently using jdk1.4.
    I can compile File.java just fine.
    But when i try to execute File.class i get an error message saying
    java.lang.noclassDefFoundError.
    This did not happen before.
    any help would greatly be appreciated.

    when you receive that error it usually indicates that the CLASSPATH does not include the directory where you are saving your .class files. If you are using Windows 2000, you need to:
    1. Right click on My Computer
    2. Go to properties
    3. Click on the Advance tab
    4. Click on Environment Variables
    5. Edit or create a new variable named ClassPath and type in something similar to this:
    .;C:\java;C:\jdk1.3.1;
    If you have Windows 95 or 98,
    Click on Start, then Run and type in sysedit, then click OK.
    Go to the AUTOEXEC.BAT file which usually is the first file to pop up. Type:
    SET CLASSPATH=.;C:\jdk1.3.1\classes;c:\java
    In the above . is the current directory; c:\jdk1.3.1\classes is a place where you can store your class files; c:\java is a directory I created on my hard drive where I store my class files..
    I hope this helps,
    Kent

  • Executing a .class file

    Hi all,
    Can anyone help me about how to execute a ".class" file from within a java Program. Thanks in advance
    Regards,
    Deepan

    i have a class file in "c:\sample.class" i want to
    run this class file from my program. How to achieve
    this? i am a newbie kindly bear with me..the reason you're not getting a straightforward answer is that this is the sort of thing you can find out for yourself in the tutorials, or from your teacher, or a book, or a simple google query. the forum isn't the place for complete novices to learn from, that would be a waste of effort on everybody's part
    get reading!

Maybe you are looking for

  • URGENT: OWB MAPPING

    i am getting the following error while executing the mapping scripts in OWB: PLEASE REPLY URGENTLY Starting Execution WINE_PRODUCTS Starting Task WINE_PRODUCTS ORA-04063: package body "OWBMISO5.WINE_PRODUCTS" has errors ORA-06508: PL/SQL: could not f

  • TS1389 I have the error 42111 when I start iTunes.

    Hello, I have the error 42111 when I start iTunes. I did not download a movie, I just installed the newest version of iTunes. I reinstalled but that didin't help. What can I do? I have Windows 8.

  • Limit, filter, or sort images in the Faces pool?

    Hi.  How can I limit, filter, or sort the images Aperture presents when "Confirm Faces" is clicked in Faces view of a named Face? I would like to either: . Limit the universe of presented images with unnamed faces to those from specific Projects; or

  • Arm strap for the Zen Mic

    I'd like to take my Micro to the gym, but I need an arm strap because I'm afraid of bumping the unit with a weight if I were to clip it to my waist. Could anyone recommend a good arm band/strap that will fit the player snugly? Anything specifically m

  • Three Easy Questions

    1) How do I turn off the metadata HUD that appears when I mouse over the image in any of the views? 2) Where are the controls to turn the background color from gray to black? 3) How do I make the previews in split view smaller and the main view as la