Opening Class Files

When I try to open the file it says:
"Exception in thread "main" java.lang.NoClassDefFoundError: ILoveJava\class".
Could you please tell me what is wrong with this program. The file is here:
This program displays "I Love Java!" to the standard output.
class ILoveJava {
public static void main(String[] args) {
System.out.println("I Love Java!");
}

Looks to me like you typed something like
java .... ILoveJava.class
try
java ... ILoveJava

Similar Messages

  • Dreamweaver can't open .class files

    Using:
    Dreamweaver CS4 Version 10 Build 4117
    on Microsoft Vista Home Premium Service Pack 2
    I'm trying to edit Menalto PHP Gallery files via Dreamweaver. Some of Gallery's core php module files use the .class file extension. I want the following extensions to be treated as PHP files in Dreamewaver.
    phtml, class, cpt
    I added these extensions to the following files.
    C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS4\configuration\DocumentTypes\MMDocumentTypes.xml
    C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS4\configuration\Extensions.txt
    C:\Users\Me\AppData\Roaming\Adobe\Dreamweaver CS4\en_US\Configuration\DocumentTypes\MMDocumentTypes.xml
    C:\Users\Me\AppData\Roaming\Adobe\Dreamweaver CS4\en_US\Configuration\Extensions.txt
    I set Vista to use Dreamweaver as the default program for opening .class files.
    I have restarted the computer.
    I can open up phtml and cpt files just fine.  However, when I try and open .class files, I get the error:
    Dreamweaver can't open .class files
    Please choose an HTML, XML, or other compatible file
    I used Dreamweaver to create a new file in the Dreamweaver file pannel.  I called the new file test.class and opened it up in notepad.  Dreamweaver is successfully pre-populating the test.class file with the default PHP template.
    So Dreamweaver is creating the test.class file using the default PHP template, but it still can't open .class files in Dreamweaver.
    I think this might be a reserved extension or something.  Anyone else had a similar problem?

    Hey, I gave up myself.  While I still use Dreamweaver for layout (HTML, images) work and for synching my website via SFTP, I don't code PHP in it anymore. Dreamweaver really isn't a PHP development IDE.  So, I do all my PHP work in something called NetBeans.  It is less user friendly but once you set it up... my goodness... is it great for coding PHP.  So Dreamweaver for visual stuff and HTML stuff.  NetBeans for PHP app development.  That's my suggestion.

  • Win xp not opening class file.

    win xp not opening class file.
    Runtime.getRuntime().exec("cmd /C start c:/database/Myclass.class");
    or
    Runtime.getRuntime().exec("cmd /C c:/database/Myclass.class");
    is this code wrong for xp ?

    let me give some more information...
    i have c:\database
    in this folder i have 2 class...Myclass.class and Dbconnection.class
    Myclass simply uses the database connection from Dbconnection.class , nothing else.
    you see both of the classes are in the same folder(i.e c:\database) and there is no package
    statement inside the code .
    in command prompt if i do....
    c:\database\java Myclass // this works fine
    but i want this class to run at runtime, so i did like above and it is not running!!
    what i am getting is a irritating windows file chooser is poping up and saying "class not
    found...browse or search in web...etc etc"
    Now my question is >
    Q1 . how can i run that class at runtime ?
    N.B
    here is some brief idea abt classes
    Dbconnection.java
    DriverManager.forClass("...database....");
    // only for database connection
    Myclass.java
    Connection con =db.getConnection();
    //use this con and show results for ur database related queries.
    }Q2. Can u plz tell those correct syntax how to run class file in this situation ?
    i will try all possible solutions tomorrow.
    thanx.

  • Why can't I open .class files?

    I have never needed to open a .class file but now I do. It pops up with an error message and says check the console. Is Jar Launcher outdated for Mavericks?
    Tech Specs:
    2010 Macbook Air OSX Mavericks
    Trying to use Jar Launcher for a .class file.

    This is not the forum for your problem. Maybe the video game section of this site or the site you got the things from.

  • Off topic... - Open .class file on double click

    Hi, I'm using windows and with the assoc and ftype commands in CMD i can make files open with a certain program and load some parameters. But I'd like to use the ftype command to open the file without the extension within.
    Here is my example:
    C:\Users\myUserName\Documents\Java>
    ftype JavaClassFile=C:\Program Files\Java\jdk1.6.0_01\bin\java.exe %*And then :
    C:\Users\Viktor\Documents\Java>Hi.class(same thing on double click)
    I get this error, wich is obvious:
    Exception in thread "main" java.lang.NoClassDefFoundError: C:\Users\Viktor\Docum
    ents\Java\Hi/classSo how can I make it open with java and leave out the .class extension in the filename?

    To be more accurate I'd like it to open
    java Hiinstead of
    java Hi.class

  • Java wont open .class file

    ok i just started at this and found this web site http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html#1
    i copyed exactly what he says to copy:
    * The HelloWorldApp class implements an application that
    * displays "Hello World!" to the standard output.
    public class HelloWorldApp {
    public static void main(String[] args) {
    // Display "Hello World!"
    System.out.println("Hello World!");
    then put all that in notepad save it as "HelloWorldApp.java". i go to the msdos prompt type in javac HelloWorldApp.java it turns it in to a .class file and i type it
    java HelloWorldApp and it gives me an error:
    Exception in thread "main" java.lang.NoClassDefFoundError: helloworldapp (wrong
    name: HelloWorldApp)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    What did I/He do wrong.

    thanks it worked. can you tell my why?

  • How to convert a .jad file to .class file in JAVA Swings.

    Hi all,
    Sorry for the interruption.I am also facing the same problem.I am using DEJDecompiler.But my application is not J2ME But J2EE.( a Swing application).I opened .class file and made some changes but I dont know how to convert into a .class file again.
    I tried saving .jad file to .java file.Then it is showing lot of errors in Eclipse Platform.I doubt if there are any errors in the .class file already,then how could the program would run.I put all the programs in the respective platforms only and then testing.It fails.
    (2) one more question,is if I do not need to disturb any existing coding and need to create a seperate java file which will do my customisation,then what should I do.I could not get any interfaces in the program.
    Please help me as the matter is most urgent.
    Thanks in advance
    With regds
    Satheesh.K

    I tried saving .jad file to .java file.Then it is
    showing lot of errors in Eclipse Platform.I doubt if
    there are any errors in the .class file already,then
    how could the program would run.I put all the programs
    in the respective platforms only and then testing.It
    fails.So who's Java program/library are you trying to steal?
    (2) one more question,is if I do not need to disturb
    any existing coding and need to create a seperate java
    file which will do my customisation,then what should I
    do.I could not get any interfaces in the program.
    Please help me as the matter is most urgent.Wow, you urgently need to steal someones program/library. The best person to give you advice urgently is the owner of the program/library you are trying to steal.
    Thanks in advancePlease don't thank me because I'm not going to help you!
    With regds
    Satheesh.K

  • How can I hide constant variable value in class file?

    hi,everybody.
    I am having a problem with constant variable which define connectted with database(URL,username,password).
    when I used UltraEdit to open class file, I can see constant variable value.
    Thanks!

    OK, let's see. Firstly, if I may correct your terminology, the phrase "constant variable" is a paradox (I think that is the right word). You have either one of the other. You declaration is either 'constant' or 'variable' (ie: it can change at run-time or it doesn't). People often use the term 'variable' and 'declaration' interchangably which is where the confusion lies.
    Anyway, onto the real problem. It seems that you want to protect your connection details (in particular the password, I would guess). Unfortunately, Java compiles not to machine-code, but byte-code which is semi-human-readable. So people, if they are inquisitive enough, will always be able to see it if they try hard enough.
    You can do one of two things:
    (1) Get an 'obfusticator'. An obfusticator is something that you run over Java source files and it completely messes it up (without modifying functionality). You then compile and the original source is such gibberish that the byte-code is very difficult to understand. However, the password will still be in there somewhere.
    (2) Don't put sensitive information into your source. Have this kind of info in external files (encrypted) and allow your class to read this file, decrypt, and use it.
    Hope that helps.
    Ben

  • Error in reading .class files

    What kind of program opens .class files?
    i'm new to java technology and am very confused with all these.
    Can someone please help?
    .class files ...
    i think its got something to do with JVM
    please send me instructions on how to run .class files
    thanks

    You need java.exe from the JRE or J2SDK. You can find the download links on the front page of http://java.sun.com. At its simplest, if your class file is called MyProgram.class, you would run it with the command "java MyProgram".

  • "Open method of Workbooks class failed" when opening Excel file via Internet Explorer

    (apologies, I posted this first to the general Office 2010 forum, but then realized this was probably a better spot to post)
    We have an Excel COM add-in installed on users' PCs.  This add-in responds to workbook open events by opening a particular XLA file (also deployed to the PC) to make certain features available.  This process works flawlessly when Excel files are
    opened locally - but when a user attempts to open an Excel file from an IE link, we get the following error: "Open method of Workbooks class failed".  This is happening on the line that is trying to open the XLA file.  This only happens
    when launching an Excel link from IE - works fine in Chrome or Firefox.
    I have found several posts on this topic, but no solutions:
    1. This post (https://social.msdn.microsoft.com/forums/office/en-US/73c96005-84af-4648-b103-32b677205be3/open-method-of-workbooks-class-failed)
    is the closest to our problem.  In this case, the "answer" was that the user may not have access to the 2nd workbook being opened.  But in our case, we're opening an XLA that is on the local machine, and I've confirmed that it is not
    corrupt and accessible (read & write, just in case!) to Everyone.
    2. This (very old) post (http://www.pcreview.co.uk/forums/open-method-workbooks-fails-excel-hosted-ie-t965608.html)
    seems similar, but is talking about opening Excel inside of IE.  This is not what we're doing - the link is supposed to (and does) open Excel outside of IE.  Interestingly, Excel.exe is being launched with the "-embedded" flag, even
    though it isn't running in the IE window.  When launching Excel by opening the file locally, Excel.exe is run with the "/dde" flag instead.  Clearly the "-embedded" mode is what is causing the problem.  I could change the
    links on the web page to use some JavaScript to open Excel differently... unfortunately, the links are actually generated by SharePoint (the Excel files are in a SP repository), so this is not really an option.
    3. This Microsoft KB article (http://support.microsoft.com/kb/268016) talks about problems opening an XLA directly from IE... but this is the case of a link pointing
    directly to an XLA file, not opening a regular workbook that in turn opens an XLA, as is my case.  In fact, this article specifically points out in the "More Information" section that "End users do not normally open XLAs; instead they open
    an XLS that (if needed) loads one or more XLAs during startup." ==> precisely what I'm trying to do that is giving me the error!
    I've replicated the situation with a very simple COM add-in (created in VS2010 using VB.Net) and a very simple XLA file (does nothing, just pops up a message in auto_open).  For anyone wanting to try it out, here is the exact test case:
    1. In Excel, create a simple XLA file containing only the following code, and save it in C:\TEMP\dummy.xla:
    Sub Auto_Open()
    MsgBox "Auto Open fired"
    End Sub
    2. In Visual Studio, create a new Excel 2010 Add-In.  I created mine via Visual Basic, but I doubt the choice of language matters.  Place the following code in ThisAddin.vb:
    Public Class ThisAddIn
    Private Sub ThisAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
    AddHandler Me.Application.WorkbookOpen, AddressOf Application_WorkbookOpen
    End Sub
    Private Sub ThisAddIn_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
    End Sub
    Sub Application_WorkbookOpen(ByVal workbook As Excel.Workbook)
    On Error GoTo ErrHandler
    If (Not workbook.Name.Contains("dummy.xla")) Then
    MsgBox("Workbook open")
    Application.Workbooks.Open("C:\temp\dummy.xla")
    Application.Workbooks("dummy.xla").RunAutoMacros(Excel.XlRunAutoMacro.xlAutoOpen)
    End If
    Exit Sub
    ErrHandler:
    MsgBox(Err.Description)
    End Sub
    End Class
    3. Build & publish this add-in and install it on the same machine as the XLA created in step 1.
    4. Create and save an empty Excel workbook (I called mine WayneTest1.xlsx) - save it locally (on your desktop), and put a copy somewhere on your web server (I put mine directly in c:\inetpub).
    5. Create an HTML file with a link to that workbook, saving it to the same web server location - here is mine:
    <html>
    <body>
    <a href="WayneTest1.xlsx">Link to Excel file</a>
    </body>
    </html>
    6. Double click the workbook on your desktop (from step 4) - opens fine, I get the "workbook open" message, following by the "Auto Open fired" message.
    7. In Internet Explorer, navigate to the HTML file specified in step 5 and click on the link - when prompted, select "Open" - I get the "workbook open" message, following by the error message "Open method of Workbooks class failed".
    Here are a few things I've ruled out / tried so far:
    - Unchecked all the "Protected View" settings in Excel, made no difference
    - Unchecked all the "File block settings" in Excel, made no difference
    - Made sure dummy.xla was open for read & write to Everyone
    - Made sure the web page was in Trusted sites and set the security level to Low for those sites in IE
    - Tried making the local desktop file (step 6) readonly, made no difference (i.e. launching it locally still worked fine)
    - Tried using Excel 2013 - made no difference
    Any ideas / suggestions?

    Hello Wayne,
    Apologies for the delay.
    I went through your post and tried to reproduce the issue. I was able to reproduce it. Based
    on its complexity and as it requires more in-depth analysis, your question falls into the paid support category which requires a more in-depth level of support.
    Please visit the below link to see the various paid support options that are
    available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone
    Thanks,
    Anush

  • Open a file within a class and be able to access it?

    hi,
    would like to reduce the code sitting in my main within a class.
    My problem is not full understanding how i can do this!
    I've been thinking along the lines of declaring the fileinputstream & Bufferstream variables as Private class variables and having the code that opens the files for reading in a method. But this fails.
    what i want to be able to do is to ....
    have methods for opening, closing, reading in a line etc
    so alls i have in my main is a loop that tests for EOF and if encountered exits.
    all the donkey work is passed onto methods which will allow the breakup of the work.
    this program is a console no GUI stuff envolved as I'm newish to java but not programming concepts, OOP does defeat me sometimes due to not being able to put understanding of principles into action.
    here is a sample of what i thought would work
    import java.io.*
    import java.util.
    public class readcsv
       //the Brace's were one of many attempts to try and get it working.
         // declare variables so i can use them in Methods
       FileReader fr = null;
       BufferReader br = null;
          // Verifies the file is open no more !
       Boolean FileOk;
      public static void main( String [] args )
        FileOk = OpenFile(); // my method for opening the file i want read.
    further code would call a readline
    another method to process the data etc etc
       // Method to open the data file and load br with the 1st line of data!
    Boolean FileOK()
    return  false;
      try
        FileReader fr = new filereader("mydata.txt");
        BufferedReader br = new BufferedReader(fr);
        // Test here for the file being opened & if it is return true
      catch (Exceptionerrors e)  /know this isn't right but more to show
        System.err.println("failed to open the file!");
    }Know the above isn't correct but i hope it give you an idea of my aim.
    haven't tried passing the variables as parameters tho but since thought of it i will give this a try.
    if someone could point me to a good worked tutorial or pass on a sample bit of code it would be appreciated.
    eg
    program will take a file name display data to the console screen then exit.
    now lets look at where and what is going on type details.
    also i have gone trolling google but from what i've seen it's a bit general overview stuff not like ....
    any thanks.
    dave.

    Possible implementation:
    import java.io.BufferedReader;
    import java.io.FileReader;
    public class Test {
        public static BufferedReader OpenFile(String fileName) throws Exception {
            return new BufferedReader(new FileReader(fileName));
        public static void processLine(String line) {
            // do something with string line
        public static void closeReader(BufferedReader in) {
            if (in != null)
                try {
                    in.close();
                } catch (Exception e) {
                    // TODO: handle exception
        public static void main(String[] args) {
            BufferedReader in = null;
            try {
                in = OpenFile("fileName");
                String line;
                while ((line = in.readLine()) != null) {
                    processLine(line);
            } catch (Exception e) {
                // TODO: handle exception
            } finally {
                closeReader(in);
    }

  • Trouble opening downloaded class files

    Hello,
    I am trying to add a simple scroller to my website, however when I download the class files Dreamweaver automatically tries to open them and they are jibberish. What program do I use to open these files?
    Thanks

    You should either use the classes as-is in your own program/applet according to the documentation, or you should be looking for the source (.java) files for those classes. Compiled classes can't be opened into something understandable by humans (unless you decompile them).

  • How to read,dispaly and open pdf files

    Hi, I am very new to Java butI have VB6.0 background. My current requirement is to read pdf file names from a directory, then
    show them on a form in a list (with their path in background pointing to the actual pdf files) and then once a user clicks any
    file name, open that file on the form.
    For example:
    My pdf files are in a directory as following:
    C:\myreports\user1\
    report1.pdf
    report2.pdf
    report3.pdf
    C:\myreports\user2\
    report1.pdf
    report5.pdf
    The output on the form should look like this if user1 has logged in the system. Side note: I am able to get userid of the logged in person in a variable.
    My Reports:
    . Report 1
    . Report 2
    . Report 3
    When a user clicks Report 1, it opens on the same form in pdf format.
    Thanks
    S.yhong

    For the first part (Listing thepdf files in the directory) you can use the java.lang.File class.
    File f = new File("path to your directory");
    File files[] = f.listFiles();
    then process the files array to find the files with extenction pdf
    You can also use a file filter object and make the listFiles method return only the pdf files.
    Please read the documentation about the File class for more info about it.
    */ For the displaying the pdf part is it good enough if you load the accrobat reader and with it. In that case you can do that using the Runtime.exec
    Also you can search for free java based pdf viewers I am sure there must be meny.
    And also the JTextPane might support pdf but I am not sure about it.
    EDIT:
    Just to say that this is my 1000th post :)
    Message was edited by:
    LRMK

  • Open/edit file

    I need to open a file, and edit part of the file based on some static text in that file. For example, lets say the text file looks something like this:
    a
    b
    c
    1
    2
    1
    a
    b
    c
    I need a program that will open the file, and delete everything from the first 1 to the last 1, and do nothing if no 1's exist.
    Afterwards, save the existing file.
    Can someone please show me how to do this?
    Thanks.

    I finished writing the program I was asking about. In case anyone needs anything like this in the future, I have posted the program here(w/ a few modifications):
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.util.Collection;
    import java.util.ArrayList;
    public class ABC{
       // Main method
       public static void main(String args[]) {
          // Stream to read file
          FileReader fr;
          FileWriter fw;
          Collection<String> lineStorage = new ArrayList<String>();
          String line = "";
          boolean finishedRemoving = true;
          final String filePath = "b.xml";
          try {
             // Open an input stream
             fr = new FileReader(filePath);
             // Read a line of text
             BufferedReader br = new BufferedReader(fr);
             while (br.ready()) { //while there's another line
                line = br.readLine();
                if (line.compareToIgnoreCase("  <app>") == 0) {
                   finishedRemoving = false;
                   continue;
                } else if (line.compareToIgnoreCase("  </app>") == 0) {
                   finishedRemoving = true;
                   continue;
                if (finishedRemoving) {
                   lineStorage.add(line);
             // Close our input stream
             fr.close();
             fw = new FileWriter(filePath);
             BufferedWriter bw = new BufferedWriter(fw);
             for (String aLineStorage : lineStorage) {
                bw.write(aLineStorage);
                bw.newLine();
             bw.flush();
             fw.close();
          // Catches any error conditions
          catch (IOException e) {
             System.err.println("Unable to read from file");
             System.exit(-1);
    }

  • Opening a file with FILE_SHARE_DELETE mode (Only on Windows)

    Hi,
    We have an application that imports logs from several 3rd party vendor's applications. Basically what we do is import the logs in real time, i.e we do have a live FileInputstream connection to the log file. Now, when the 3rd party applications that rotate these logs (many of them do when they grow big or scheduled periodically), all unix flavors dont see to have any problem, while the windows does complain that the device or resource is busy and the original application is not allowed to rotate it. When i dug into the native code of windows jvm, i found that the file is not opened in the FILE_SHARE_DELETE mode and only with FILE_SHARE_READ and FILE_SHARE_WRITE modes. When we wrote a separate C++ application the opens a file with FILE_SHARE_DELETE mode, we found that the logs are rotatable.
    Now, how can we instruct the JVM to open a file with FILE_SHARE_DELETE mode? Is there any such implementation already or do i have to come up with another class extending the FileInputStream and use a totally different open method where the file is opened with this mode in the native code?
    Thanks
    Manava

    Hello,
    I think you can write :
    Runtime.getRuntime().exec("start.exe " + MyFileDialog.getDirectory() + MyFileDialog.getFile());
    So, "start.exe" choose the application (not valid for NT machine), ".getDirectory()" return the PATH and ".getFile()" return the NAME.
    Best regards from France
    Thierry

Maybe you are looking for

  • Fields missing from PSA Hierarchy transfer structures

    Hi, I am facing a strange problem. After replicating the source system and running program RS_TRANSTRU_ACTIVATE_ALL  we are getting errors in 0Equipment_hier and 0funct_loc_hier. it complains about missing equnr and tplnr fields from the transfer str

  • New Hard drive and no original OS install disks to hand.

    Hi, Just installed a new WD hard drive after my original HD died after 2 and a half years of use, unfortunately I do not have my Tiger disks to hand. Do I have to buy the full Snow Leopard Box Set to install with no previous OS system or could the SL

  • IDOC-FILE - If IDOC is not triggered, need to genarate file with constants

    Hi Friends, I have a scenario like this. IDOC to FILE scenario. 1. IDOC will get triggerd everyday and flat file will be genatated at specified location. 2. If IDOC is not genarated for the day, need to genarate falt file with some constants. Can any

  • Since upgrading to firefox 4.0 i am unable to log into my Youtube account. Please help!!

    After putting in my log in information it goes straight back to the home page of youtube. I know my log in works because when going to google my email address appears on the home page as if I am logged into youtube. Please does anyone know how to fix

  • Core file generating in tuxedo8.1

    Hi, we are using tuxedo8.1 and we are seeing core file getting generated and not able to identify the reason for the same. below are the details using debugger below is the output we got file core core: ELF-64 core file - IA64 from 'ck_CustomerUdt' -