I need a strong response to my question. I can write and compile a java application. The computer won't run the applications when the proper java command is used in command prompt. I did load the Java run time environment. The applet will load using an html tag. Whats happening with my applications? The applications will compile without error.

If your talking about an applet,try making the class public

Is this an applet or an application? They are started in different ways.
What is the exact "proper java command" you are using?

what compiler are u using, jGrasp, JCreator or netbeans, etc

Unless you've provided your applet with a main() method, it's not surprising that you can't run it from the command line using the "java ProgName" command.

To run an applet from the command line, use "appletviewer x.html" where x.html is an html file with an <applet> tag calling on your applet.
Bruce Eckel has a nice trick for this, where he embeds the applet tag in a comment in the applet source file - see his "Thinking In Java" for the details, it's available to read on line for free. The problem with this, of course, is that it requires the source code to reside in the same directory as the compiled code, which is what you don't want except when you're building a toy app for testing or prototyping, so it's not a hugely useful trick, but it's cool anyway.


If your applet also has a main method, then your problem is a different one. In that case, more information is needed. Please copy the command you're using and the result you get (any compiler output) and post it here, along with the source for the file you're trying to run.

@cretaros: you might want to check the difference between an IDE (integrated development environment) and a compiler.

since we still have no response to wether or not we're talking about an actual application or applet here,

could you please post the code you're trying to run here, and any error messages you're getting?

yes, the problem might be you're trying to run an applet as an application, but it might also be you're getting a number of exceptions thrown when your code runs / tries to run. if we're talking unchecked exceptions, this might also be the problemn you'll have to deal with.

Applets are java programs that are required to run in web browsers. Applications are java programs that can act as a stand alone program, and can be converted in exe's and executable jar files. You can only run applications using the command prompt. Applets have to be integrated into websites.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.