Results 1 to 9 of 9

Thread: Java problems

  1. #1

    Java problems

    I am getting my feet wet with java programming using Visual Cafe 4.5.1. So could somebody give me a solution to my problem very very very laymans language.


    I am attempting to run a simple print text message program in visual cafe.
    Here's the code.

    //Displays Welcome message

    public class Welcome {
    //main method begins execution of Java application
    public static void main( String args[] )
    {
    System.out.println("Welcome to Java");
    }//end method main
    }
    However when I open an empty project insert this file into this project and
    attempt to run it I get the following message. Unable to run untitled.class.
    Check that you have properly specified name of the class containing main
    in your project settings. What exactly am I missing here? Also on the startup
    I get the following message in debugger window Platform does not know about
    os ver.5.1., not sure if this has anything to do with the above described
    problem.

    Thank you for your help.

  2. #2
    Join Date
    Sep 2002
    Location
    Dallas, TX
    Posts
    205
    Well, the code looks fine. I am not sure what Visual Cafe is doing behind the scenes but it's crucial that the file that contains this class is named Welcome.java.

    Worse case scenario; just copy that text into a regular text editor, then name it Welcome.java. Run javac Welcome.java (note that javac.exe might not be in your path). Then, if there are no compiler errors, type java Welcome.
    justin 'at' abrogo.com
    http://www.abrogo.com
    Shared Unix Hosting

  3. #3
    Join Date
    Oct 2002
    Location
    OKlahoma
    Posts
    1
    you need to title the .java file the exact same name as the class name
    so if you have:
    public class Welcome

    you need to name the file Welcome.java not untitled....


    it should work for you then

  4. #4
    Join Date
    Sep 2002
    Location
    Dallas, TX
    Posts
    205
    Way to read the thread.
    justin 'at' abrogo.com
    http://www.abrogo.com
    Shared Unix Hosting

  5. #5
    Cool!! You guys put me on the right path. Problem was that in Visual cafe you have to create what is known as project. You then add you file with code to this project and then it compiles and executes the code. This project needs to know the main class name and usually it knows it by default because you name your file exactly the same as your main class, in my case it did not pick it up so I had to add the main class name in the project settings manually. Now it works

    Thanks for the tips

  6. #6
    By the way, IDEA from http://intellij.com is much better IDE than Visual Cafe. (I personally think IDEA is best IDE for Java now available on market)
    All generalizations are false, including this one.

  7. #7
    Join Date
    Sep 2002
    Location
    Dallas, TX
    Posts
    205
    I dig Netbeans (http://www.netbeans.org)...but don't try to run it on anything less than 1GHz/512MB memory.
    justin 'at' abrogo.com
    http://www.abrogo.com
    Shared Unix Hosting

  8. #8
    IDEA is quite awesome. It has lot's of tools that Visual Cafe can't even compare to. it can automatically take a piece of code and create a method out of it, or do lot's of other cool stuff.

    But it is very expensive, and we already made the mistake to buy Visual Cafe licenses, so were stuck with it LoL.

    But VisualCafe does sometimes mess up the project file, causing us a big headache. Backup your VisualCafe files often!.
    Walter Landman
    Simplicato - Email Hosting

  9. #9
    Originally posted by wlandman
    IDEA is quite awesome. It has lot's of tools that Visual Cafe can't even compare to. it can automatically take a piece of code and create a method out of it, or do lot's of other cool stuff.

    But it is very expensive, and we already made the mistake to buy Visual Cafe licenses, so were stuck with it LoL.

    But VisualCafe does sometimes mess up the project file, causing us a big headache. Backup your VisualCafe files often!.
    As far as I know with IDEA you can always use test key, only drawback is that sometimes you should go to their site almost every day for new key. It's like you working for them as tester
    All generalizations are false, including this one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •