JAVA.exe does not work! Help!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 11 of 11

Thread: JAVA.exe does not work! Help!

  1. #1
    Join Date
    Aug 2003
    Posts
    6

    JAVA.exe does not work! Help!

    I'm new to Java programming, so i use a free developemnet kit and i use the tutorials featured on this site. They told me to write the code in "notepad" Compile it into a "class" file, with Javac.exe. Then run the java class using JAVA.exe. Problem is, when I try to run the class file using Java. I get a command prompt screen, then a message flickers, then the window closes befor i can even read what it said, therefor, I cant see the finished product. Is anyone else having this problem? Is it a compatibility issue with XP?

    BTW, it does the same with the demo classes that came with the program as well, i have to run them with the html document that came with them.

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    OK. First thing's first - have you downloaded the Software Development Kit (SDK)? You should have a folder on your computer called 'bin' and it should contain a number of .EXE files including both 'javac.exe' and 'java.exe'.

    Next, fire up a command prompt:
    Code:
    C:\>java -version
    java version "1.4.1_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
    Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
    Did this happen?
    ArchAngel.
    O:-)

  3. #3
    Join Date
    Aug 2003
    Posts
    6
    I think my comand prompt is screwed up. nothin works on it, or maybe i have no idea what im doin with it. its default directory is C:\>documents and settings/my user name. I cant change directories. It says everything is an invalid command, maybe i just dont know what im doin with it though. I try to run the class file by right clicking on the class file, click on "open with" select java.exe, then a command prompt window pops up, displays a message really fast, closes before i can even read it. I really want to get into java programming, and need some serious help with the software.

  4. #4
    Join Date
    Mar 2003
    Posts
    834

    Post

    I sounds like you're not really sure about what you're doing, so let's take this step-by-step. Please answer these questions - it makes life much easier rather than running 'round like a headless chicken.

    1. Have you downloaded the Software Development Kit (SDK)?

    Y/N?

    2. If you answered "Yes", then you should have a folder somewhere on your computer called 'bin' and it should contain a number of .EXE files including both 'javac.exe' and 'java.exe'. Is this correct?

    Y/N?

    3. If you answered "Yes", then you should be able to open a command prompt:
    Code:
    C:\>java -version
    java version "1.4.1_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
    Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
    Did this work?

    Y/N?
    ArchAngel.
    O:-)

  5. #5
    Join Date
    Aug 2003
    Posts
    6
    Kinda ignore the rest, unless you really wanna read it.

    ::Okay, i wrote the code you gave me, and i also tried "java UserInput.class" and got the same problem message.

    "
    Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion' has value '1.4', but '1.3' is required.
    Error: could not find java.dll
    Error: could not find Java 2 Runtime Environment.

    Ok, I know i have java.dll and Java 2 Runtime Environment. It came with the rest of the kit. But first says its the wrong version? But it can't find it anyways. I dunno, please help me out here.
    1 yes

    2 yes

    3 This is my problem. Ok, so I open a brand new command prompt window and i type that code in? And then it should work hunky-dory like? I can't seem to get my command prompt to do anything. Maybe I just don't know how to use it, i havent used DOS since like windows 95.

    Heres what I have tried.

    1 I would open java.exe by clicking on it. Does not work, i didnt really think it would.

    2 Right click on my .class file, click on open with, select Java.exe. Some message comes up on a command prompt, says something, before i can read it, it closes. I can make out like the first word, "exeption"

  6. #6
    Join Date
    Mar 2003
    Posts
    834
    1 I would open java.exe by clicking on it. Does not work, i didnt really think it would.

    2 Right click on my .class file, click on open with, select Java.exe. Some message comes up on a command prompt, says something, before i can read it, it closes. I can make out like the first word, "exeption"

    Nope. Things don't work quite like that.

    If you're getting this message:

    "Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion' has value '1.4', but '1.3' is required.
    Error: could not find java.dll
    Error: could not find Java 2 Runtime Environment."

    Then your installation of Java is corrupted (you probably have more than one version of Java installed on your computer and they're both trying to sit on top of each other).

    I seriously recommend that you uninstall all versions of Java and then install the latest SDK from Sun.
    ArchAngel.
    O:-)

  7. #7
    Join Date
    Aug 2003
    Posts
    6
    Ok, i hope this is the last time i should post for this topic.

    I downloaded the newest version 1.4.2, that also came with NetBeans, and i was able to run the class through netbeans. Btw, that looks like a pretty useful tool, you can type the code on it, compile it, and Run it, all through that program.

  8. #8
    Join Date
    Mar 2003
    Posts
    834

    Lightbulb

    I'm glad it's sorted. :-)

    However, just a suggestion for future development. I've been doing Java now for quite a few years and I have found on more than one occasion that being able to work with the Java from command-line is invaluable. I would suggest that you at least try and compile a simple "Hello World" program from the command line , be familiar with the command-line programs: java, javac, javaw, javap etc. and at least be aware of the main 'switches' on the java and javac commands.

    It's just a suggestion. You won't always be using NetBeans (e.g. if you get a Java job and the company has a different IDE).
    ArchAngel.
    O:-)

  9. #9
    Join Date
    Nov 2002
    Posts
    138
    yep i wonder why people here in my CS college even prefer blue jay over the command prompt. they don't even know how to go about compiling their code in the command prompt. sheesh! and we are supposed to be CS students! teachers did this! that ide ( blue jay ) is... i don't wanna comment. jcreator is fine but .... i think the IDE i once used that i liked was borland jbuilder. netbeans is too slow. i just hate it!

  10. #10
    Join Date
    Mar 2003
    Posts
    834
    I'm by no means against IDE's.

    At work I use (now) Boland's Together Solo which is nice because there is an exact relationship between the UML diagrams and the code (none of this "generate" and "reverse engineer" rubbish). I find it really helpful in the prototyping of classes.

    Sometimes, println() statements just aren't good enough and that's where debuggers are worth their weight in gold - especially in multi-threaded environments.

    Refactoring tools in IDE's are also start to become pretty standard. I don't know how I ever survived renaming a variable or method before without these tools - simply wonderful!

    There are lots of other things that I find really helpful in IDE's, however, if when required you can't go back to notepad (or Vi, depending upon your manliness) and the command prompt, I think it's a real gap in your knowledge. A good understanding of these mechanics can be really helpful when the IDE goes wrong (often CLASSPATH or Java version problems).
    ArchAngel.
    O:-)

  11. #11
    Join Date
    Nov 2002
    Posts
    138
    of course i'm not against these IDEs. my point was, freshies here in our school are not being taught on the notepad-command prompt combo of writing-compiling their code. they get an IDE instead to do all. they don't even know how to set the path! hahaha!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center